summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ironic/common/rpc.py2
-rw-r--r--ironic/tests/unit/common/test_rpc.py23
-rw-r--r--releasenotes/notes/configure-notifications-72824356e7d8832a.yaml2
3 files changed, 25 insertions, 2 deletions
diff --git a/ironic/common/rpc.py b/ironic/common/rpc.py
index 7c02be69b..dbf702bb9 100644
--- a/ironic/common/rpc.py
+++ b/ironic/common/rpc.py
@@ -43,7 +43,7 @@ TRANSPORT_ALIASES = {
def init(conf):
- global TRANSPORT, NOTIFIER
+ global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
exmods = get_allowed_exmods()
TRANSPORT = messaging.get_transport(conf,
allowed_remote_exmods=exmods,
diff --git a/ironic/tests/unit/common/test_rpc.py b/ironic/tests/unit/common/test_rpc.py
index 6e10aac07..a4a3e17c1 100644
--- a/ironic/tests/unit/common/test_rpc.py
+++ b/ironic/tests/unit/common/test_rpc.py
@@ -11,11 +11,34 @@
# under the License.
import mock
+from oslo_config import cfg
+import oslo_messaging as messaging
from ironic.common import context as ironic_context
from ironic.common import rpc
from ironic.tests import base
+CONF = cfg.CONF
+
+
+class TestUtils(base.TestCase):
+
+ @mock.patch.object(messaging, 'Notifier', autospec=True)
+ @mock.patch.object(messaging, 'JsonPayloadSerializer', autospec=True)
+ @mock.patch.object(messaging, 'get_notification_transport', autospec=True)
+ @mock.patch.object(messaging, 'get_transport', autospec=True)
+ def test_init_globals(self, mock_get_transport, mock_get_notification,
+ mock_serializer, mock_notifier):
+ rpc.TRANSPORT = None
+ rpc.NOTIFICATION_TRANSPORT = None
+ rpc.NOTIFIER = None
+ rpc.init(CONF)
+ self.assertEqual(mock_get_transport.return_value, rpc.TRANSPORT)
+ self.assertEqual(mock_get_notification.return_value,
+ rpc.NOTIFICATION_TRANSPORT)
+ self.assertTrue(mock_serializer.called)
+ self.assertEqual(mock_notifier.return_value, rpc.NOTIFIER)
+
class TestRequestContextSerializer(base.TestCase):
diff --git a/releasenotes/notes/configure-notifications-72824356e7d8832a.yaml b/releasenotes/notes/configure-notifications-72824356e7d8832a.yaml
index c3ba11646..097ea6c6f 100644
--- a/releasenotes/notes/configure-notifications-72824356e7d8832a.yaml
+++ b/releasenotes/notes/configure-notifications-72824356e7d8832a.yaml
@@ -1,6 +1,6 @@
---
features:
- - It is now possible to configure the notifications tu use a different
+ - It is now possible to configure the notifications to use a different
transport URL than the RPCs. These could potentially be completely
different message broker hosts (though they don't need to be). If the
notification-specific configuration is not provided, the notifier will use