3
# Copyright (c) 2015, PLUMgrid Inc, http://plumgrid.com
5
# The hooks of this charm have been symlinked to functions
5
10
from charmhelpers.core.hookenv import (
7
12
UnregisteredHookError,
16
from charmhelpers.fetch import (
13
22
from pg_dir_utils import (
41
Install hook is run when the charm is first deployed on a node.
43
configure_sources(update=True)
44
pkgs = determine_packages()
46
apt_install(pkg, options=['--force-yes'], fatal=True)
29
53
@hooks.hook('plumgrid-plugin-relation-joined')
30
54
def plumgrid_dir():
36
@hooks.hook('plumgrid-relation-joined')
37
def plumgrid_joined(relation_id=None):
38
#We can pass information to the edge and gateway from there.
40
'pg_virtual_ip': config('plumgrid-virtual-ip'),
42
relation_set(relation_id=relation_id, **relation_data)
56
This hook is run when relation between neutron-api-plumgrid
57
and plumgrid-director is made.
66
@hooks.hook('config-changed')
69
This hook is run when a config parameter is changed.
70
It also runs on node reboot.
73
configure_sources(update=True)
74
pkgs = determine_packages()
76
apt_install(pkg, options=['--force-yes'], fatal=True)
45
85
@hooks.hook('stop')
88
This hook is run when the charm is destroyed.
92
pkgs = determine_packages()
94
apt_purge(pkg, fatal=False)