[jamespage] Switch to using common vhost for all openstack services
This commit is contained in:
@@ -27,8 +27,8 @@ options:
|
|||||||
Note that quantum/neutron is only supported >= Folsom.
|
Note that quantum/neutron is only supported >= Folsom.
|
||||||
rabbit-user:
|
rabbit-user:
|
||||||
type: string
|
type: string
|
||||||
default: nova
|
default: neutron
|
||||||
rabbit-vhost:
|
rabbit-vhost:
|
||||||
type: string
|
type: string
|
||||||
default: nova
|
default: openstack
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from charmhelpers.core.hookenv import (
|
|||||||
config,
|
config,
|
||||||
relation_get,
|
relation_get,
|
||||||
relation_set,
|
relation_set,
|
||||||
|
relation_ids,
|
||||||
unit_get,
|
unit_get,
|
||||||
Hooks, UnregisteredHookError
|
Hooks, UnregisteredHookError
|
||||||
)
|
)
|
||||||
@@ -84,6 +85,10 @@ def config_changed():
|
|||||||
|
|
||||||
@hooks.hook('upgrade-charm')
|
@hooks.hook('upgrade-charm')
|
||||||
def upgrade_charm():
|
def upgrade_charm():
|
||||||
|
# NOTE(jamespage): Deal with changes to rabbitmq configuration for
|
||||||
|
# common virtual host across services
|
||||||
|
for r_id in relation_ids('amqp'):
|
||||||
|
amqp_joined(relation_id=r_id)
|
||||||
install()
|
install()
|
||||||
config_changed()
|
config_changed()
|
||||||
|
|
||||||
@@ -99,8 +104,9 @@ def db_joined():
|
|||||||
|
|
||||||
|
|
||||||
@hooks.hook('amqp-relation-joined')
|
@hooks.hook('amqp-relation-joined')
|
||||||
def amqp_joined():
|
def amqp_joined(relation_id=None):
|
||||||
relation_set(username=config('rabbit-user'),
|
relation_set(relation_id=relation_id,
|
||||||
|
username=config('rabbit-user'),
|
||||||
vhost=config('rabbit-vhost'))
|
vhost=config('rabbit-vhost'))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ TO_PATCH = [
|
|||||||
'CONFIGS',
|
'CONFIGS',
|
||||||
'configure_ovs',
|
'configure_ovs',
|
||||||
'relation_set',
|
'relation_set',
|
||||||
|
'relation_ids',
|
||||||
'unit_get',
|
'unit_get',
|
||||||
'relation_get',
|
'relation_get',
|
||||||
'install_ca_cert',
|
'install_ca_cert',
|
||||||
@@ -99,9 +100,12 @@ class TestQuantumHooks(CharmTestCase):
|
|||||||
def test_upgrade_charm(self):
|
def test_upgrade_charm(self):
|
||||||
_install = self.patch('install')
|
_install = self.patch('install')
|
||||||
_config_changed = self.patch('config_changed')
|
_config_changed = self.patch('config_changed')
|
||||||
|
_amqp_joined = self.patch('amqp_joined')
|
||||||
|
self.relation_ids.return_value = ['amqp:0']
|
||||||
self._call_hook('upgrade-charm')
|
self._call_hook('upgrade-charm')
|
||||||
_install.assert_called()
|
self.assertTrue(_install.called)
|
||||||
_config_changed.assert_called()
|
self.assertTrue(_config_changed.called)
|
||||||
|
_amqp_joined.assert_called_with(relation_id='amqp:0')
|
||||||
|
|
||||||
def test_db_joined(self):
|
def test_db_joined(self):
|
||||||
self.unit_get.return_value = 'myhostname'
|
self.unit_get.return_value = 'myhostname'
|
||||||
@@ -118,8 +122,9 @@ class TestQuantumHooks(CharmTestCase):
|
|||||||
def test_amqp_joined(self):
|
def test_amqp_joined(self):
|
||||||
self._call_hook('amqp-relation-joined')
|
self._call_hook('amqp-relation-joined')
|
||||||
self.relation_set.assert_called_with(
|
self.relation_set.assert_called_with(
|
||||||
username='nova',
|
username='neutron',
|
||||||
vhost='nova',
|
vhost='openstack',
|
||||||
|
relation_id=None
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_amqp_changed(self):
|
def test_amqp_changed(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user