From 887e5a042359ed2b424d6e079f13d460213eeff6 Mon Sep 17 00:00:00 2001
From: Doug Hellmann <doug@doughellmann.com>
Date: Tue, 2 Jun 2015 18:48:33 +0000
Subject: [PATCH] Ensure rpc_response_timeout is registered before using it

The response code in the rabbit driver doesn't use a Client object, so
the option is not being registered in servers that don't instantiate
Client instances (ironic-conductor, for example).

Change-Id: I7def5e6d4960938a17344db024585a0492d6969d
Partial-bug: #1461182
---
 oslo_messaging/_drivers/impl_rabbit.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py
index 83a30be99..8e79639b7 100644
--- a/oslo_messaging/_drivers/impl_rabbit.py
+++ b/oslo_messaging/_drivers/impl_rabbit.py
@@ -41,6 +41,7 @@ from oslo_messaging._i18n import _LE
 from oslo_messaging._i18n import _LI
 from oslo_messaging._i18n import _LW
 from oslo_messaging import exceptions
+from oslo_messaging.rpc import client as rpc_client
 
 
 rabbit_opts = [
@@ -998,6 +999,12 @@ class Connection(object):
             RuntimeError("_publish_and_retry_on_missing_exchange() must be "
                          "called with an passive exchange.")
 
+        # FIXME(dhellmann): This is a hack to make sure the option
+        # we're about to use is registered. Since we're not going
+        # through a Client object here, it won't be registered by
+        # Client.__init__. We should do this more cleanly.
+        self.conf.register_opts(rpc_client._client_opts)
+
         # TODO(sileht): use @retrying
         # NOTE(sileht): no need to wait the application expect a response
         # before timeout is exshauted