Fix unit-test errors and code-cleanup
This commit is contained in:
parent
52bc2e4ec5
commit
7c482421d6
@ -154,9 +154,14 @@ class NeutronCCContext(context.NeutronContext):
|
||||
for k, v in _config.iteritems():
|
||||
if k.startswith('vsd'):
|
||||
ctxt[k.replace('-', '_')] = v
|
||||
if 'vsd-address' in _config:
|
||||
ctxt['vsd_server'] = _config['vsd-address']
|
||||
elif 'vsd_server' not in ctxt:
|
||||
for rid in relation_ids('vsd-rest-api'):
|
||||
for unit in related_units(rid):
|
||||
rdata = relation_get(rid=rid, unit=unit)
|
||||
vsd_ip = rdata.get('vsd-ip-address')
|
||||
log('relation data:vsd-ip-address: {}'.format(vsd_ip))
|
||||
if vsd_ip is not None:
|
||||
ctxt['vsd_server'] = '{}:8443'.format(vsd_ip)
|
||||
if 'vsd_server' not in ctxt:
|
||||
ctxt['vsd_server'] = '1.1.1.1:8443'
|
||||
|
||||
ctxt['verbose'] = config('verbose')
|
||||
|
@ -130,8 +130,6 @@ def install():
|
||||
key = config('neutron-plugin-ppa-key')
|
||||
add_source(config('neutron-plugin-repository-url'), key)
|
||||
packages += config('vsp-packages').split()
|
||||
if config('vsd-server'):
|
||||
save_vsd_address_to_config(config('vsd-server'))
|
||||
|
||||
apt_update()
|
||||
apt_install(packages, fatal=True)
|
||||
@ -171,18 +169,11 @@ def vsd_changed(relation_id=None, remote_unit=None):
|
||||
if not vsd_ip_address:
|
||||
return
|
||||
vsd_address = '{}:8443'.format(vsd_ip_address)
|
||||
save_vsd_address_to_config(vsd_address)
|
||||
log('vsd-rest-api-relation-changed: ip address:{}'.format(vsd_address))
|
||||
vsd_config_file = config('vsd-config-file')
|
||||
update_config_file(vsd_config_file, 'server', vsd_address)
|
||||
|
||||
|
||||
def save_vsd_address_to_config(vsd_address):
|
||||
_config = config()
|
||||
_config['vsd-address'] = vsd_address
|
||||
_config.save()
|
||||
|
||||
|
||||
@hooks.hook('upgrade-charm')
|
||||
@hooks.hook('config-changed')
|
||||
@restart_on_change(restart_map(), stopstart=True)
|
||||
|
@ -56,7 +56,6 @@ TO_PATCH = [
|
||||
'update_nrpe_config',
|
||||
'service_reload',
|
||||
'IdentityServiceContext',
|
||||
'save_vsd_address_to_config',
|
||||
'update_config_file',
|
||||
]
|
||||
NEUTRON_CONF_DIR = "/etc/neutron"
|
||||
|
Loading…
Reference in New Issue
Block a user