~junaidali/charms/trusty/plumgrid-edge/trunk

« back to all changes in this revision

Viewing changes to hooks/pg_edge_hooks.py

  • Committer: bbaqar at plumgrid
  • Date: 2015-08-09 15:48:20 UTC
  • Revision ID: bbaqar@plumgrid.com-20150809154820-bqhjde31l5e33b6x
Support added for metadata

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
    Hooks,
12
12
    UnregisteredHookError,
13
13
    log,
 
14
    relation_set,
 
15
    relation_ids,
 
16
    config,
14
17
)
15
18
 
16
19
from charmhelpers.fetch import (
63
66
    restart_pg()
64
67
 
65
68
 
 
69
@hooks.hook('neutron-plugin-relation-joined')
 
70
@hooks.hook('plumgrid-plugin-relation-joined')
 
71
def neutron_plugin_joined(relation_id=None):
 
72
    rel_data = {
 
73
        'metadata-shared-secret': config('metadata-shared-key'),
 
74
    }
 
75
    relation_set(relation_id=relation_id, **rel_data)
 
76
 
 
77
 
66
78
@hooks.hook('config-changed')
67
79
def config_changed():
68
80
    '''
76
88
        apt_install(pkg, options=['--force-yes'], fatal=True)
77
89
    load_iovisor()
78
90
    ensure_mtu()
 
91
    for rid in relation_ids('neutron-plugin'):
 
92
        neutron_plugin_joined(rid)
 
93
    for rid in relation_ids('plumgrid-plugin'):
 
94
        neutron_plugin_joined(rid)
79
95
    ensure_files()
80
96
    add_lcm_key()
81
97
    CONFIGS.write_all()