Switch to using common vhost for all openstack services
This commit is contained in:
parent
812fafd5b7
commit
c323f70a5c
@ -23,7 +23,7 @@ options:
|
|||||||
type: string
|
type: string
|
||||||
description: Username used to access rabbitmq queue
|
description: Username used to access rabbitmq queue
|
||||||
rabbit-vhost:
|
rabbit-vhost:
|
||||||
default: nova
|
default: openstack
|
||||||
type: string
|
type: string
|
||||||
decsription: Rabbitmq vhost
|
decsription: Rabbitmq vhost
|
||||||
database-user:
|
database-user:
|
||||||
|
@ -82,8 +82,10 @@ def config_changed():
|
|||||||
|
|
||||||
@hooks.hook('amqp-relation-joined')
|
@hooks.hook('amqp-relation-joined')
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def amqp_joined():
|
def amqp_joined(relation_id=None):
|
||||||
relation_set(username=config('rabbit-user'), vhost=config('rabbit-vhost'))
|
relation_set(relation_id=relation_id,
|
||||||
|
username=config('rabbit-user'),
|
||||||
|
vhost=config('rabbit-vhost'))
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('amqp-relation-changed')
|
@hooks.hook('amqp-relation-changed')
|
||||||
@ -199,6 +201,12 @@ def relation_broken():
|
|||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
|
|
||||||
|
|
||||||
|
@hooks.hook('upgrade-charm')
|
||||||
|
def upgrade_charm():
|
||||||
|
for r_id in relation_ids('amqp'):
|
||||||
|
amqp_joined(relation_id=r_id)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
hooks.execute(sys.argv)
|
hooks.execute(sys.argv)
|
||||||
|
1
hooks/upgrade-charm
Symbolic link
1
hooks/upgrade-charm
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
nova_compute_hooks.py
|
@ -105,7 +105,8 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||||||
|
|
||||||
def test_amqp_joined(self):
|
def test_amqp_joined(self):
|
||||||
hooks.amqp_joined()
|
hooks.amqp_joined()
|
||||||
self.relation_set.assert_called_with(username='nova', vhost='nova')
|
self.relation_set.assert_called_with(username='nova', vhost='openstack',
|
||||||
|
relation_id=None)
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
@patch.object(hooks, 'CONFIGS')
|
||||||
def test_amqp_changed_missing_relation_data(self, configs):
|
def test_amqp_changed_missing_relation_data(self, configs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user