diff --git a/hooks/neutron_plumgrid_hooks.py b/hooks/neutron_plumgrid_hooks.py index 9c4c10c..9d13048 100755 --- a/hooks/neutron_plumgrid_hooks.py +++ b/hooks/neutron_plumgrid_hooks.py @@ -6,7 +6,6 @@ # in this file. import sys -from charmhelpers.core.host import service_running from charmhelpers.core.hookenv import ( Hooks, UnregisteredHookError, @@ -17,7 +16,9 @@ from charmhelpers.core.hookenv import ( from charmhelpers.core.host import ( restart_on_change, - service_restart + service_start, + service_stop, + service_running ) from charmhelpers.fetch import ( @@ -74,12 +75,14 @@ def config_changed(): pkgs = determine_packages() for pkg in pkgs: apt_install(pkg, options=['--force-yes'], fatal=True) - service_restart('neutron-server') + service_stop('neutron-server') if (charm_config.changed('networking-plumgrid-version') or charm_config.changed('pip-proxy')): ensure_files() - service_restart('neutron-server') + service_stop('neutron-server') CONFIGS.write_all() + if not service_running('neutron-server'): + service_start('neutron-server') @hooks.hook('neutron-plugin-api-relation-joined') diff --git a/hooks/neutron_plumgrid_utils.py b/hooks/neutron_plumgrid_utils.py index ed4fd67..3fd483c 100644 --- a/hooks/neutron_plumgrid_utils.py +++ b/hooks/neutron_plumgrid_utils.py @@ -87,17 +87,16 @@ def determine_packages(): enable PLUMgrid in Openstack. ''' pkgs = [] - tag = 'latest' for pkg in PG_PACKAGES: + tag = '' if pkg == 'plumgrid-pythonlib': tag = config('plumgrid-build') elif (pkg == 'networking-plumgrid' and config('enable-deb-networking-install')): tag = config('networking-build') - if tag == 'latest': pkgs.append(pkg) - else: + elif tag: if tag in [i.ver_str for i in apt_cache()[pkg].version_list]: pkgs.append('%s=%s' % (pkg, tag)) else: