Merge lp:~niedbalski/charm-helpers/fix-lp-1445025 into lp:charm-helpers

Proposed by Jorge Niedbalski
Status: Merged
Merged at revision: 360
Proposed branch: lp:~niedbalski/charm-helpers/fix-lp-1445025
Merge into: lp:charm-helpers
Diff against target: 59 lines (+31/-0)
2 files modified
charmhelpers/contrib/openstack/context.py (+5/-0)
tests/contrib/openstack/test_os_contexts.py (+26/-0)
To merge this branch: bzr merge lp:~niedbalski/charm-helpers/fix-lp-1445025
Reviewer Review Type Date Requested Status
Edward Hope-Morley Needs Fixing
Felipe Reyes (community) Approve
charmers Pending
Review via email: mp+256556@code.launchpad.net

Description of the change

Exposes the oslo-messaging-flags to AMQP context partially fixes #1445025

To post a comment you must log in.
Revision history for this message
Felipe Reyes (freyes) wrote :

LGTM

review: Approve
Revision history for this message
Edward Hope-Morley (hopem) wrote :

One small nit (see inline) and this is good-to-go thanks Jorge!

review: Needs Fixing
360. By Jorge Niedbalski

Addressed @dosaboy comments

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charmhelpers/contrib/openstack/context.py'
--- charmhelpers/contrib/openstack/context.py 2015-04-13 07:40:54 +0000
+++ charmhelpers/contrib/openstack/context.py 2015-04-16 20:27:54 +0000
@@ -459,6 +459,11 @@
459459
460 ctxt['rabbitmq_hosts'] = ','.join(sorted(rabbitmq_hosts))460 ctxt['rabbitmq_hosts'] = ','.join(sorted(rabbitmq_hosts))
461461
462 oslo_messaging_flags = conf.get('oslo-messaging-flags', None)
463 if oslo_messaging_flags:
464 ctxt['oslo_messaging_flags'] = config_flags_parser(
465 oslo_messaging_flags)
466
462 if not context_complete(ctxt):467 if not context_complete(ctxt):
463 return {}468 return {}
464469
465470
=== modified file 'tests/contrib/openstack/test_os_contexts.py'
--- tests/contrib/openstack/test_os_contexts.py 2015-04-13 07:40:54 +0000
+++ tests/contrib/openstack/test_os_contexts.py 2015-04-16 20:27:54 +0000
@@ -212,6 +212,10 @@
212 'rabbit-vhost': 'foo',212 'rabbit-vhost': 'foo',
213}213}
214214
215AMQP_OSLO_CONFIG = {
216 'oslo-messaging-flags': "rabbit_max_retries=1,rabbit_retry_backoff=1,rabbit_retry_interval=1"
217}
218
215AMQP_NOVA_CONFIG = {219AMQP_NOVA_CONFIG = {
216 'nova-rabbit-user': 'adam',220 'nova-rabbit-user': 'adam',
217 'nova-rabbit-vhost': 'foo',221 'nova-rabbit-vhost': 'foo',
@@ -950,6 +954,28 @@
950 }954 }
951 self.assertEquals(result, expected)955 self.assertEquals(result, expected)
952956
957 def test_amqp_context_with_oslo_messaging(self):
958 """Test amqp context with oslo-messaging-flags option"""
959 relation = FakeRelation(relation_data=AMQP_RELATION)
960 self.relation_get.side_effect = relation.get
961 AMQP_OSLO_CONFIG.update(AMQP_CONFIG)
962 self.config.return_value = AMQP_OSLO_CONFIG
963 amqp = context.AMQPContext()
964 result = amqp()
965 expected = {
966 'rabbitmq_host': 'rabbithost',
967 'rabbitmq_password': 'foobar',
968 'rabbitmq_user': 'adam',
969 'rabbitmq_virtual_host': 'foo',
970 'oslo_messaging_flags': {
971 'rabbit_max_retries': '1',
972 'rabbit_retry_backoff': '1',
973 'rabbit_retry_interval': '1'
974 },
975 }
976
977 self.assertEquals(result, expected)
978
953 def test_ceph_no_relids(self):979 def test_ceph_no_relids(self):
954 '''Test empty ceph realtion'''980 '''Test empty ceph realtion'''
955 relation = FakeRelation(relation_data={})981 relation = FakeRelation(relation_data={})

Subscribers

People subscribed via source and target branches