3
# Copyright (c) 2015, PLUMgrid Inc, http://plumgrid.com
5
# The hooks of this charm have been symlinked to functions
10
from charmhelpers.core.hookenv import (
12
UnregisteredHookError,
16
from charmhelpers.core.host import (
20
from charmhelpers.fetch import (
27
from neutron_plumgrid_utils import (
35
CONFIGS = register_configs()
41
Install hook is run when the charm is first deployed on a node.
45
apt_install(determine_packages(), options=['--force-yes'], fatal=True)
49
@hooks.hook('config-changed')
52
This hook is run when a config parameter is changed.
53
It also runs on node reboot.
58
apt_install(determine_packages(), options=['--force-yes'], fatal=True)
63
@hooks.hook('neutron-plugin-api-relation-joined')
64
@hooks.hook('plumgrid-plugin-relation-changed')
65
@hooks.hook('container-relation-changed')
66
@restart_on_change(restart_map())
67
def relation_changed():
69
This hook is run when relation between neutron-api-plumgrid and
70
neutron-api or plumgrid-edge is made.
79
This hook is run when the charm is destroyed.
81
pkgs = determine_packages()
83
apt_purge(pkg, fatal=False)
88
hooks.execute(sys.argv)
89
except UnregisteredHookError as e:
90
log('Unknown hook {} - skipping.'.format(e))
93
if __name__ == '__main__':