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
1=== modified file 'charmhelpers/contrib/openstack/context.py'
2--- charmhelpers/contrib/openstack/context.py 2015-04-13 07:40:54 +0000
3+++ charmhelpers/contrib/openstack/context.py 2015-04-16 20:27:54 +0000
4@@ -459,6 +459,11 @@
5
6 ctxt['rabbitmq_hosts'] = ','.join(sorted(rabbitmq_hosts))
7
8+ oslo_messaging_flags = conf.get('oslo-messaging-flags', None)
9+ if oslo_messaging_flags:
10+ ctxt['oslo_messaging_flags'] = config_flags_parser(
11+ oslo_messaging_flags)
12+
13 if not context_complete(ctxt):
14 return {}
15
16
17=== modified file 'tests/contrib/openstack/test_os_contexts.py'
18--- tests/contrib/openstack/test_os_contexts.py 2015-04-13 07:40:54 +0000
19+++ tests/contrib/openstack/test_os_contexts.py 2015-04-16 20:27:54 +0000
20@@ -212,6 +212,10 @@
21 'rabbit-vhost': 'foo',
22 }
23
24+AMQP_OSLO_CONFIG = {
25+ 'oslo-messaging-flags': "rabbit_max_retries=1,rabbit_retry_backoff=1,rabbit_retry_interval=1"
26+}
27+
28 AMQP_NOVA_CONFIG = {
29 'nova-rabbit-user': 'adam',
30 'nova-rabbit-vhost': 'foo',
31@@ -950,6 +954,28 @@
32 }
33 self.assertEquals(result, expected)
34
35+ def test_amqp_context_with_oslo_messaging(self):
36+ """Test amqp context with oslo-messaging-flags option"""
37+ relation = FakeRelation(relation_data=AMQP_RELATION)
38+ self.relation_get.side_effect = relation.get
39+ AMQP_OSLO_CONFIG.update(AMQP_CONFIG)
40+ self.config.return_value = AMQP_OSLO_CONFIG
41+ amqp = context.AMQPContext()
42+ result = amqp()
43+ expected = {
44+ 'rabbitmq_host': 'rabbithost',
45+ 'rabbitmq_password': 'foobar',
46+ 'rabbitmq_user': 'adam',
47+ 'rabbitmq_virtual_host': 'foo',
48+ 'oslo_messaging_flags': {
49+ 'rabbit_max_retries': '1',
50+ 'rabbit_retry_backoff': '1',
51+ 'rabbit_retry_interval': '1'
52+ },
53+ }
54+
55+ self.assertEquals(result, expected)
56+
57 def test_ceph_no_relids(self):
58 '''Test empty ceph realtion'''
59 relation = FakeRelation(relation_data={})

Subscribers

People subscribed via source and target branches