From 86e59d7457f8cc6c4ce72e231ac4e78c04ac678a Mon Sep 17 00:00:00 2001
From: David Ames <david.ames@canonical.com>
Date: Thu, 23 Feb 2017 11:43:10 -0500
Subject: [PATCH] Charm-heleprs sync for AMQP context fix

In Ocata nova uses the transport_url for communication to rabbitmq.
In the charm the default port 5672 was assumed. However, when
rabbitmq uses SSL it changes the port to 5671.

This pulls in the fix which makes the default port explicit and
changes the port when SSL is in use.

Change-Id: Ic9c24d33550c4c899cabca3667871212dabac1f7
Closes-bug: #1667362
---
 hooks/charmhelpers/contrib/openstack/context.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/hooks/charmhelpers/contrib/openstack/context.py
index 18cde988..bec7538e 100644
--- a/hooks/charmhelpers/contrib/openstack/context.py
+++ b/hooks/charmhelpers/contrib/openstack/context.py
@@ -393,7 +393,7 @@ class AMQPContext(OSContextGenerator):
             ha_vip_only = False
             self.related = True
             transport_hosts = None
-            rabbitmq_port = ''
+            rabbitmq_port = '5672'
             for unit in related_units(rid):
                 if relation_get('clustered', rid=rid, unit=unit):
                     ctxt['clustered'] = True
@@ -417,6 +417,7 @@ class AMQPContext(OSContextGenerator):
                 ssl_port = relation_get('ssl_port', rid=rid, unit=unit)
                 if ssl_port:
                     ctxt['rabbit_ssl_port'] = ssl_port
+                    rabbitmq_port = ssl_port
 
                 ssl_ca = relation_get('ssl_ca', rid=rid, unit=unit)
                 if ssl_ca: