From 27cd4dd70b5a51919ce0091ab4247f65e5a27526 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 25 Aug 2017 17:13:48 -0400 Subject: [PATCH] Change default for [notifications]/default_publisher_id to $host The default used in code for CONF.notifications.default_publisher_id is CONF.host, which is a free-form StrOpt. In an upcoming change, the "my_ip" option is going to be changed from a StrOpt to an IPOpt, so we made the default value change for the default_publisher_id option before that. Change-Id: Ia85130f66bd5a60097e8967064559fd0962d06fd Closes-Bug: #1713150 --- nova/conf/notifications.py | 6 +++--- nova/tests/unit/test_notifications.py | 4 ++++ .../bug-1713150-default_publisher_id-f46f4f6a39347951.yaml | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/bug-1713150-default_publisher_id-f46f4f6a39347951.yaml diff --git a/nova/conf/notifications.py b/nova/conf/notifications.py index a1381c16fba4..f42631b37bf1 100644 --- a/nova/conf/notifications.py +++ b/nova/conf/notifications.py @@ -65,7 +65,7 @@ API service. cfg.StrOpt( 'default_publisher_id', - default='$my_ip', + default='$host', deprecated_group='DEFAULT', deprecated_for_removal=True, deprecated_since='17.0.0', @@ -81,12 +81,12 @@ notifications using different publisher, change this value accordingly. Possible values: -* Defaults to the IPv4 address of this host, but it can be any valid +* Defaults to the current hostname of this host, but it can be any valid oslo.messaging publisher_id Related options: -* my_ip - IP address of this host +* host - Hostname, FQDN or IP address of this host. """), cfg.StrOpt( 'notification_format', diff --git a/nova/tests/unit/test_notifications.py b/nova/tests/unit/test_notifications.py index 6de2aae78568..688e14f16a3c 100644 --- a/nova/tests/unit/test_notifications.py +++ b/nova/tests/unit/test_notifications.py @@ -19,6 +19,7 @@ import copy import datetime import mock +from oslo_config import cfg from oslo_context import context as o_context from oslo_context import fixture as o_fixture from oslo_utils import timeutils @@ -36,6 +37,8 @@ from nova.tests.unit import fake_network from nova.tests.unit import fake_notifier from nova.tests import uuidsentinel as uuids +CONF = cfg.CONF + class NotificationsTestCase(test.TestCase): @@ -625,6 +628,7 @@ class NotificationsTestCase(test.TestCase): self.assertEqual(n.event_type, func_name) self.assertEqual(n.context, ctxt) self.assertTrue(self.decorated_function_called) + self.assertEqual(CONF.host, n.publisher_id) class NotificationsFormatTestCase(test.NoDBTestCase): diff --git a/releasenotes/notes/bug-1713150-default_publisher_id-f46f4f6a39347951.yaml b/releasenotes/notes/bug-1713150-default_publisher_id-f46f4f6a39347951.yaml new file mode 100644 index 000000000000..840c5f876257 --- /dev/null +++ b/releasenotes/notes/bug-1713150-default_publisher_id-f46f4f6a39347951.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + The ``[notifications]/default_publisher_id`` configuration option now + defaults to ``[DEFAULT]/host`` rather than ``[DEFAULT]/my_ip``.