diff options
author | 2017-05-08 11:09:02 +0800 | |
---|---|---|
committer | 2017-05-15 08:24:35 +0000 | |
commit | f20effca792bb5dfa2898585f3431de5d296064f (patch) | |
tree | 2323e6d85a03d8673e1a5fc89d7658f1575cb2e5 /deploy/client.py | |
parent | f0f025b1137da4ab12b0db76620c332fac3335bc (diff) |
Update moon role for moonv4
JIRA: -
To deploy moon(master/slave) scenario configure moon role in DHA file like:
- name: host4
roles:
- moon
To deploy moon master, export MOON_CFG env like below compass deploy:
export MOON_CFG="master:flag=Disable,slave:flag=Enable,slave:name=slave1,slave:master_ip=master_ip"
To deploy moon slave, export MOON_CFG env like below compass deploy:
export MOON_CFG="master:flag=Enable,slave:flag=Disable,slave:name=slave1,slave:master_ip=master_ip"
Change-Id: Ie300a85979af31634ab0660ccee1ee8b094110b5
Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'deploy/client.py')
-rw-r--r-- | deploy/client.py | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/deploy/client.py b/deploy/client.py index a0d70644..e3591e51 100644 --- a/deploy/client.py +++ b/deploy/client.py @@ -243,9 +243,9 @@ opts = [ cfg.StrOpt('odl_l3_agent', help='odl l3 agent enable flag', default='Disable'), - cfg.StrOpt('moon', - help='moon enable flag', - default='Disable'), + cfg.StrOpt('moon_cfg', + help='moon config', + default='master:flag=Disable,slave:flag=Disable,slave:name=slave1,slave:master_ip=master_ip'), # noqa cfg.StrOpt('onos_sfc', help='onos_sfc enable flag', default='Disable'), @@ -718,6 +718,30 @@ class CompassClient(object): 'password': password } + moon_cfgs = [ + cfg + for cfg in CONF.moon_cfg.split(',') + if cfg + ] + LOG.info( + 'moon configure: %s', moon_cfgs + ) + moon_cfg = {} + for cfg in moon_cfgs: + if ':' not in cfg: + raise Exception( + 'there is no : in cfg %s' % cfg # noqa + ) + role, conf_pair = cfg.split(':', 1) + if '=' not in conf_pair: + raise Exception( + 'there is no = in %s configure pair' % conf_pair + ) + key, value = conf_pair.split('=', 1) + moon_cfg[role] = {} if role not in moon_cfg else moon_cfg[role] + moon_cfg[role][key] = value + package_config["moon_cfg"] = moon_cfg + package_config["security"] = {"service_credentials": service_credential_cfg, # noqa "console_credentials": console_credential_cfg} # noqa @@ -751,12 +775,10 @@ class CompassClient(object): package_config['enable_secgroup'] = (CONF.enable_secgroup == "true") package_config['enable_fwaas'] = (CONF.enable_fwaas == "true") package_config['enable_vpnaas'] = (CONF.enable_vpnaas == "true") - package_config[ - 'odl_l3_agent'] = "Enable" if CONF.odl_l3_agent == "Enable" else "Disable" # noqa - package_config[ - 'moon'] = "Enable" if CONF.moon == "Enable" else "Disable" - package_config[ - 'onos_sfc'] = "Enable" if CONF.onos_sfc == "Enable" else "Disable" + package_config['odl_l3_agent'] = "Enable" \ + if CONF.odl_l3_agent == "Enable" else "Disable" + package_config['onos_sfc'] = "Enable" \ + if CONF.onos_sfc == "Enable" else "Disable" status, resp = self.client.update_cluster_config( cluster_id, package_config=package_config) |