diff --git a/src/lib/charm/openstack/aodh.py b/src/lib/charm/openstack/aodh.py index 79f2ea1..17e91c6 100644 --- a/src/lib/charm/openstack/aodh.py +++ b/src/lib/charm/openstack/aodh.py @@ -85,7 +85,7 @@ class AodhCharm(charms_openstack.charm.HAOpenStackCharm): # file changes restart_map = { AODH_CONF: services, - AODH_API_SYSTEMD_CONF: 'aodh-api', + AODH_API_SYSTEMD_CONF: ['aodh-api'], } # Resource when in HA mode @@ -125,6 +125,23 @@ class AodhCharm(charms_openstack.charm.HAOpenStackCharm): ch_host.service_restart('aodh-api') +class AodhCharmNewton(AodhCharm): + """Newton uses the aodh-api standalone systemd. If the systemd definition + changes the a systemctl daemon-reload is needed. + """ + release = 'newton' + + def render_with_interfaces(self, interface_list): + if os.path.exists(AODH_API_SYSTEMD_CONF): + old_hash = ch_host.file_hash(AODH_API_SYSTEMD_CONF) + else: + old_hash = '' + super(AodhCharmNewton, self).render_with_interfaces(interface_list) + new_hash = ch_host.file_hash(AODH_API_SYSTEMD_CONF) + if old_hash != new_hash: + self.reload_and_restart() + + class AodhCharmOcata(AodhCharm): """From ocata onwards there is no aodh-api service, as this is handled via apache2 with a wsgi handler. Therefore, these specialisations are simple diff --git a/src/reactive/aodh_handlers.py b/src/reactive/aodh_handlers.py index 4a33945..0c62aa1 100644 --- a/src/reactive/aodh_handlers.py +++ b/src/reactive/aodh_handlers.py @@ -103,9 +103,3 @@ def run_db_migration(): @reactive.when('ha.connected') def cluster_connected(hacluster): aodh.configure_ha_resources(hacluster) - - -# TODO: drop once charm switches to apache+mod_wsgi -@reactive.when_file_changed(aodh.AODH_API_SYSTEMD_CONF) -def systemd_override_changed(): - aodh.reload_and_restart()