Updated config-changed hook and restart_pg()
This commit is contained in:
parent
f8987ff8ca
commit
2e99af9387
|
@ -14,6 +14,8 @@ from charmhelpers.core.hookenv import (
|
||||||
config,
|
config,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from charmhelpers.core.host import service_running
|
||||||
|
|
||||||
from charmhelpers.fetch import (
|
from charmhelpers.fetch import (
|
||||||
apt_install,
|
apt_install,
|
||||||
apt_purge,
|
apt_purge,
|
||||||
|
@ -82,13 +84,12 @@ def config_changed():
|
||||||
if not fabric_interface_changed():
|
if not fabric_interface_changed():
|
||||||
log("Fabric interface already set")
|
log("Fabric interface already set")
|
||||||
else:
|
else:
|
||||||
restart_pg()
|
stop_pg()
|
||||||
if charm_config.changed('os-data-network'):
|
if charm_config.changed('os-data-network'):
|
||||||
if charm_config['fabric-interfaces'] == 'MANAGEMENT':
|
if charm_config['fabric-interfaces'] == 'MANAGEMENT':
|
||||||
log('Fabric running on managment network')
|
log('Fabric running on managment network')
|
||||||
if (charm_config.changed('install_sources') or
|
if (charm_config.changed('install_sources') or
|
||||||
charm_config.changed('plumgrid-build') or
|
charm_config.changed('plumgrid-build') or
|
||||||
charm_config.changed('plumgrid-virtual-ip') or
|
|
||||||
charm_config.changed('iovisor-build')):
|
charm_config.changed('iovisor-build')):
|
||||||
stop_pg()
|
stop_pg()
|
||||||
configure_sources(update=True)
|
configure_sources(update=True)
|
||||||
|
@ -97,8 +98,11 @@ def config_changed():
|
||||||
apt_install(pkg, options=['--force-yes'], fatal=True)
|
apt_install(pkg, options=['--force-yes'], fatal=True)
|
||||||
remove_iovisor()
|
remove_iovisor()
|
||||||
load_iovisor()
|
load_iovisor()
|
||||||
restart_pg()
|
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
|
# Restarting the plumgrid service only if it is
|
||||||
|
# already stopped by any config-parameters or node reboot
|
||||||
|
if not service_running('plumgrid'):
|
||||||
|
restart_pg()
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('upgrade-charm')
|
@hooks.hook('upgrade-charm')
|
||||||
|
|
|
@ -148,7 +148,8 @@ def restart_pg():
|
||||||
# wait for 3 secs so that libvirt-bin can be completely up and
|
# wait for 3 secs so that libvirt-bin can be completely up and
|
||||||
# start the plumgrid service
|
# start the plumgrid service
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
service_start('plumgrid')
|
if not service_start('plumgrid'):
|
||||||
|
raise ValueError("plumgrid service couldn't be started")
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue