Updates, checkin link.s

This commit is contained in:
Adam Gandelman 2013-10-10 09:04:40 -07:00
parent 0b661186b0
commit ed71ab066c
4 changed files with 32 additions and 19 deletions

View File

@ -490,27 +490,32 @@ class SubordinateConfigContext(OSContextGenerator):
def __call__(self): def __call__(self):
ctxt = {} ctxt = {}
for rid in relation_ids(self.interface): for rid in relation_ids(self.interface):
sub_config = relation_get('subordinate_config', relaton_id=rid) for unit in related_units(rid):
if sub_config and sub_config != '': sub_config = relation_get('subordinate_config',
try: relaton_id=rid, unit=unit)
sub_config = json.loads(sub_config) if sub_config and sub_config != '':
except: try:
log('Could not parse JSON from subordinate_config setting ' sub_config = json.loads(sub_config)
'from %s' % rid, level=ERROR) except:
log('Could not parse JSON from subordinate_config '
'setting from %s' % rid, level=ERROR)
if self.service not in sub_config: if self.service not in sub_config:
log('Found subordinate_config on %s but it contained' log('Found subordinate_config on %s but it contained'
'nothing for %s service' % (rid, self.service)) 'nothing for %s service' % (rid, self.service))
continue continue
sub_config = sub_config[self.service] sub_config = sub_config[self.service]
if self.config_file not in sub_config: if self.config_file not in sub_config:
log('Found subordinate_config on %s but it contained' log('Found subordinate_config on %s but it contained'
'nothing for %s' % (rid, self.config_file)) 'nothing for %s' % (rid, self.config_file))
continue continue
sub_config = sub_config[self.config_file] sub_config = sub_config[self.config_file]
for k, v in sub_config.iteritems(): for k, v in sub_config.iteritems():
ctxt[k] = v ctxt[k] = v
if not ctxt:
ctxt['sections'] = {}
return ctxt return ctxt

View File

@ -0,0 +1 @@
nova_cc_hooks.py

View File

@ -0,0 +1 @@
nova_cc_hooks.py

View File

@ -401,6 +401,12 @@ def nova_vmware_relation_joined():
relation_set(network_manager=network_manager()) relation_set(network_manager=network_manager())
@hooks.hook()
@restart_on_change(restart_map())
def nova_vmware_relation_changed():
CONFIGS.write('/etc/nova/nova.conf')
def main(): def main():
try: try:
hooks.execute(sys.argv) hooks.execute(sys.argv)