Restarting neutron-server after PG upgrade/downgrade

Making sure neutron-server is restarted after a PG package upgrade/downgrade
This commit is contained in:
Junaid Ali 2016-08-26 14:52:18 +05:00 committed by GitHub
commit 1fd81a665b
2 changed files with 9 additions and 7 deletions

View File

@ -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')

View File

@ -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: