Updated config-changed hook
This commit is contained in:
parent
7bdfecd976
commit
ed6f3e70c9
@ -12,6 +12,7 @@ from charmhelpers.core.hookenv import (
|
||||
Hooks,
|
||||
UnregisteredHookError,
|
||||
log,
|
||||
config,
|
||||
)
|
||||
|
||||
from charmhelpers.core.host import (
|
||||
@ -50,18 +51,23 @@ def install():
|
||||
|
||||
|
||||
@hooks.hook('config-changed')
|
||||
@restart_on_change(restart_map())
|
||||
def config_changed():
|
||||
'''
|
||||
This hook is run when a config parameter is changed.
|
||||
It also runs on node reboot.
|
||||
'''
|
||||
stop()
|
||||
configure_sources()
|
||||
apt_update()
|
||||
pkgs = determine_packages()
|
||||
for pkg in pkgs:
|
||||
apt_install(pkg, options=['--force-yes'], fatal=True)
|
||||
ensure_files()
|
||||
charm_config = config()
|
||||
if (charm_config.changed('install_sources') or
|
||||
charm_config.changed('plumgrid-build') or
|
||||
charm_config.changed('install_keys')):
|
||||
configure_sources()
|
||||
apt_update()
|
||||
pkgs = determine_packages()
|
||||
for pkg in pkgs:
|
||||
apt_install(pkg, options=['--force-yes'], fatal=True)
|
||||
if charm_config.changed('networking-plumgrid-version'):
|
||||
ensure_files()
|
||||
CONFIGS.write_all()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user