From 958dfc3e2fd44f51171b781ba5c969bfb45d2eed Mon Sep 17 00:00:00 2001 From: Liam Young Date: Wed, 18 Oct 2017 10:28:07 +0000 Subject: [PATCH] Address all rabbit units in clustered deploy If rabbitmq is deployed in a cluster then the ceilometer charm will pass rabbitmq_hosts and rabbitmq_host to ceilometer-agent. This charm was ignoring the rabbitmq_hosts key and thus always talking to a single rabbit even if there were multiple. Change-Id: I42c2e3ee4ee2bd1feb9815a4d9895a7121801995 Closes-Bug: #1670273 --- .gitignore | 1 + hooks/ceilometer_contexts.py | 3 ++- unit_tests/test_ceilometer_contexts.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 80007cf..34a9602 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tags *.pyc .unit-state.db trusty +.stestr diff --git a/hooks/ceilometer_contexts.py b/hooks/ceilometer_contexts.py index bdd4066..ec88fc8 100644 --- a/hooks/ceilometer_contexts.py +++ b/hooks/ceilometer_contexts.py @@ -53,7 +53,8 @@ class CeilometerServiceContext(OSContextGenerator): optional_keys = [ 'rabbit_ssl_port', - 'rabbit_ssl_ca' + 'rabbit_ssl_ca', + 'rabbitmq_hosts' ] def __init__(self, ssl_dir=None): diff --git a/unit_tests/test_ceilometer_contexts.py b/unit_tests/test_ceilometer_contexts.py index 1a4e51c..4bef1c4 100644 --- a/unit_tests/test_ceilometer_contexts.py +++ b/unit_tests/test_ceilometer_contexts.py @@ -38,6 +38,7 @@ class CeilometerContextsTest(CharmTestCase): 'debug': True, 'verbose': False, 'rabbitmq_host': 'foo', + 'rabbitmq_hosts': 'foo,bar', 'rabbitmq_user': 'bar', 'rabbitmq_password': 'baz', 'rabbitmq_virtual_host': 'openstack',