Add hooks for amqp-nova relation
This commit is contained in:
parent
ec3344fbfa
commit
55a942f6bb
1
hooks/amqp-nova-relation-changed
Symbolic link
1
hooks/amqp-nova-relation-changed
Symbolic link
@ -0,0 +1 @@
|
||||
quantum_hooks.py
|
1
hooks/amqp-nova-relation-departed
Symbolic link
1
hooks/amqp-nova-relation-departed
Symbolic link
@ -0,0 +1 @@
|
||||
quantum_hooks.py
|
1
hooks/amqp-nova-relation-joined
Symbolic link
1
hooks/amqp-nova-relation-joined
Symbolic link
@ -0,0 +1 @@
|
||||
quantum_hooks.py
|
@ -83,6 +83,8 @@ def config_changed():
|
||||
pgsql_db_joined(relation_id=r_id)
|
||||
for r_id in relation_ids('amqp'):
|
||||
amqp_joined(relation_id=r_id)
|
||||
for r_id in relation_ids('amqp-nova'):
|
||||
amqp_nova_joined(relation_id=r_id)
|
||||
if valid_plugin():
|
||||
CONFIGS.write_all()
|
||||
configure_ovs()
|
||||
@ -123,6 +125,12 @@ def pgsql_db_joined(relation_id=None):
|
||||
relation_id=relation_id)
|
||||
|
||||
|
||||
@hooks.hook('amqp-nova-relation-joined')
|
||||
def amqp_nova_joined(relation_id=None):
|
||||
relation_set(relation_id=relation_id,
|
||||
username=config('nova-rabbit-user'),
|
||||
vhost=config('nova-rabbit-vhost'))
|
||||
|
||||
@hooks.hook('amqp-relation-joined')
|
||||
def amqp_joined(relation_id=None):
|
||||
relation_set(relation_id=relation_id,
|
||||
@ -130,6 +138,14 @@ def amqp_joined(relation_id=None):
|
||||
vhost=config('rabbit-vhost'))
|
||||
|
||||
|
||||
@hooks.hook('amqp-nova-relation-departed')
|
||||
@restart_on_change(restart_map())
|
||||
def amqp_nova_departed():
|
||||
if 'amqp-nova' not in CONFIGS.complete_contexts():
|
||||
log('amqp relation incomplete. Peer not ready?')
|
||||
return
|
||||
CONFIGS.write_all()
|
||||
|
||||
@hooks.hook('amqp-relation-departed')
|
||||
@restart_on_change(restart_map())
|
||||
def amqp_departed():
|
||||
@ -142,6 +158,7 @@ def amqp_departed():
|
||||
@hooks.hook('shared-db-relation-changed',
|
||||
'pgsql-db-relation-changed',
|
||||
'amqp-relation-changed',
|
||||
'amqp-nova-relation-changed',
|
||||
'cluster-relation-changed',
|
||||
'cluster-relation-joined')
|
||||
@restart_on_change(restart_map())
|
||||
|
Loading…
Reference in New Issue
Block a user