Send comments to principle for inclusion in config, also add restart support

This commit is contained in:
Liam Young 2014-06-10 12:50:03 +00:00
parent 58db4bd4dd
commit 9b48491b62
2 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
import uuid
import sys
import json
@ -40,7 +40,13 @@ def config_changed():
CONFIGS.write_all()
@hooks.hook('neutron-plugin-relation-joined')
def neutron_plugin_relation_joined():
def neutron_plugin_relation_joined(remote_restart=True):
if remote_restart:
comment = ('restart', 'Restart Trigger: ' + str(uuid.uuid4()))
for conf in NEUTRON_SETTINGS['neutron']:
if 'sections' in NEUTRON_SETTINGS['neutron'][conf] and \
'COMMENT' in NEUTRON_SETTINGS['neutron'][conf]['sections']:
NEUTRON_SETTINGS['neutron'][conf]['sections']['COMMENT'].append(comment)
relation_set(subordinate_configuration=json.dumps(NEUTRON_SETTINGS))
@restart_on_change(restart_map())

View File

@ -1,6 +1,5 @@
from charmhelpers.contrib.openstack.neutron import neutron_plugin_attribute
from copy import deepcopy
from charmhelpers.contrib.openstack import templating
from collections import OrderedDict
from charmhelpers.contrib.openstack.utils import (
@ -33,6 +32,9 @@ NEUTRON_SETTINGS = {
"DEFAULT": [
('core_plugin', 'neutron.plugins.ml2.plugin.Ml2Plugin'),
('service_plugins', ','.join(NEUTRON_SERVICE_PLUGINS)),
],
"COMMENT": [
('comment1', 'Warning: some settings controlled by subordinate neutron-openvswitch'),
]
}
},
@ -40,6 +42,9 @@ NEUTRON_SETTINGS = {
"sections": {
"DEFAULT": [
('NEUTRON_PLUGIN_CONFIG', ML2_CONF),
],
"COMMENT": [
('comment1', 'Warning: some settings controlled by subordinate neutron-openvswitch'),
]
}
}