Add hooks for amqp-nova relation

This commit is contained in:
Liam Young 2014-06-06 13:02:28 +00:00
parent ec3344fbfa
commit 55a942f6bb
4 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1 @@
quantum_hooks.py

View File

@ -0,0 +1 @@
quantum_hooks.py

View File

@ -0,0 +1 @@
quantum_hooks.py

View File

@ -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())