Remove deprecated deploy config parameter

Change-Id: Ib7464b4ddaca0ab53b348869ccf07bb578fee91d
Closes-bug: #1630499
This commit is contained in:
Dmitry Tyzhnenko 2016-10-05 16:53:49 +03:00 committed by Dmitry Tyzhnenko
parent 794d931e93
commit 55520fd90e
3 changed files with 70 additions and 17 deletions

View File

@ -70,10 +70,23 @@ def ccpcluster(revert_snapshot, config, hardware,
# Install CCP
if config.ccp.os_host == '0.0.0.0':
ccp_actions.install_ccp()
ccp_actions.put_yaml_config(
settings.DEPLOY_CONFIG,
settings.CCP_DEFAULT_GLOBALS)
ccp_actions.init_default_config()
path=settings.CCP_DEPLOY_CONFIG,
config=settings.CCP_DEFAULT_GLOBALS)
ccp_actions.put_yaml_config(
path=settings.CCP_SOURCES_CONFIG,
config=settings.CCP_BUILD_SOURCES)
with open(settings.TOPOLOGY_PATH, 'r') as f:
ccp_actions.put_raw_config(
path=settings.CCP_DEPLOY_TOPOLOGY,
content=f.read())
ccp_actions.init_default_config(include_files=[
settings.CCP_DEPLOY_CONFIG,
settings.CCP_SOURCES_CONFIG,
settings.CCP_DEPLOY_TOPOLOGY])
config.ccp.os_host = config.k8s.kube_host
hardware.create_snapshot(ext.SNAPSHOT.ccp_deployed)

View File

@ -52,13 +52,6 @@ class CCPManager(object):
LOG.debug("*** Result STDOUT:\n{0}".format(result.stdout_str))
LOG.debug("*** Result STDERR:\n{0}".format(result.stderr_str))
if use_defaults:
LOG.info("Use defaults config from ccp")
cmd = ('cat fuel-ccp/etc/topology-example.yaml '
'>> {deploy_config}').format(
deploy_config=settings.DEPLOY_CONFIG)
remote.check_call(cmd, verbose=True)
@property
def default_params(self):
if hasattr(self, '_default_params'):
@ -69,8 +62,21 @@ class CCPManager(object):
def default_params(self, v):
self._default_params = v.copy()
def init_default_config(self):
def init_default_config(self, include_files=None):
self.put_yaml_config('~/.ccp.yaml', settings.CCP_CONF)
self.add_includes('~/.ccp.yaml', include_files)
def add_includes(self, path, files):
def clear_tilda(p):
return p.replace('~/', '')
content = "---\n!include\n{}".format(
'\n'.join(['- ' + clear_tilda(f) for f in files]))
cmd = 'echo "{content}" >> {path}'.format(
path=path, content=content)
with self.__underlay.remote(
host=self.__config.k8s.kube_host) as remote:
remote.execute(cmd)
def put_raw_config(self, path, content):
"""Put config content to file on admin node at path
@ -84,6 +90,16 @@ class CCPManager(object):
host=self.__config.k8s.kube_host) as remote:
remote.execute(cmd)
def get_raw_config(self, path):
"""Get config content from file at path on admin node
:param path: path to config file
:return: str
"""
with self.__underlay.remote(
host=self.__config.k8s.kube_host) as remote:
return remote.open(path).read()
def put_yaml_config(self, path, config):
"""Convert config dict to yaml and put it to admin node at path
@ -97,6 +113,16 @@ class CCPManager(object):
host=self.__config.k8s.kube_host) as remote:
remote.execute(cmd)
def get_yaml_config(self, path):
"""Get config content from file at path on admin node
:param path: path to config file
:return: dict
"""
with self.__underlay.remote(
host=self.__config.k8s.kube_host) as remote:
return yaml.load(remote.open(path))
def __build_param_string(self, params=None):
if params is None:
params = self.default_params

View File

@ -112,7 +112,12 @@ for key, val in CALICO.items():
if val is not None:
DEFAULT_CUSTOM_YAML[key] = val
DEPLOY_CONFIG = '/tmp/ccp-globals.yaml'
CCP_DEPLOY_CONFIG = '~/.ccp.deploy-config.yaml'
CCP_DEPLOY_TOPOLOGY = '~/.ccp.deploy-topology.yaml'
TOPOLOGY_PATH = os.environ.get('TOPOLOGY_PATH',
os.getcwd() + '/fuel_ccp_tests/templates/'
'k8s_templates/k8s_topology.yaml')
FUEL_CCP_KEYSTONE_LOCAL_REPO = os.environ.get('FUEL_CCP_KEYSTONE_LOCAL_REPO',
None)
@ -163,11 +168,14 @@ CCP_CONF = {
'kubernetes': {
'namespace': 'ccp'
},
'deploy_config': DEPLOY_CONFIG,
'images': {
'namespace': IMAGES_NAMESPACE,
'tag': IMAGES_TAG
},
}
}
CCP_SOURCES_CONFIG = '~/.ccp.build-sources.yaml'
CCP_BUILD_SOURCES = {
'sources': OS_REPOS
}
@ -177,11 +185,17 @@ CCP_CLI_PARAMS = {
"log-file": "ccp.log",
}
IFACES = {
"public": os.environ.get("IFACE_PUBLIC", "ens3"),
"private": os.environ.get("IFACE_PRIVATE", "ens4"),
"neutron": os.environ.get("IFACE_NEUTRON", "ens5"),
}
CCP_DEFAULT_GLOBALS = {
"configs": {
"private_interface": "eth0",
"public_interface": "eth1",
"neutron_external_interface": "eth2"
"private_interface": IFACES['private'],
"public_interface": IFACES['public'],
"neutron_external_interface": IFACES['neutron']
}
}