From 98454aaf86b7da4d4ddd97b64c222c5da8c2c210 Mon Sep 17 00:00:00 2001
From: Joe Harrison <joehazzers@gmail.com>
Date: Thu, 16 Jan 2014 19:06:31 +0100
Subject: [PATCH] Allow different login methods to be used with kombu
 connections

Currently it is not possible to modify the login method used with
kombu connections via configuration files, and requires modifying
the source code to actually add a login method in the first place.
This adds a configuration option (and default) which are passed
along to the kombu connection.

RabbitMQ allows three login method strings by default, but server
side plugins allow arbitrarily named strings to be used as login
methods and as such it is not possible to provide a fixed list of
options to the user.

DocImpact

Change-Id: I5c62a8dd4125d42bb429d3985061e37a9d519fff
Closes-Bug: #1269890
---
 oslo/messaging/_drivers/impl_rabbit.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/oslo/messaging/_drivers/impl_rabbit.py b/oslo/messaging/_drivers/impl_rabbit.py
index ad8c823cc..a816ab681 100644
--- a/oslo/messaging/_drivers/impl_rabbit.py
+++ b/oslo/messaging/_drivers/impl_rabbit.py
@@ -75,6 +75,9 @@ rabbit_opts = [
                default='guest',
                help='The RabbitMQ password',
                secret=True),
+    cfg.StrOpt('rabbit_login_method',
+               default='AMQPLAIN',
+               help='the RabbitMQ login method'),
     cfg.StrOpt('rabbit_virtual_host',
                default='/',
                help='The RabbitMQ virtual host'),
@@ -437,6 +440,7 @@ class Connection(object):
                 'port': port,
                 'userid': self.conf.rabbit_userid,
                 'password': self.conf.rabbit_password,
+                'login_method': self.conf.rabbit_login_method,
                 'virtual_host': self.conf.rabbit_virtual_host,
             }