diff --git a/keystone/common/config.py b/keystone/common/config.py index 500d28c13e..c9a5091995 100644 --- a/keystone/common/config.py +++ b/keystone/common/config.py @@ -13,7 +13,7 @@ # under the License. from oslo.config import cfg -from oslo import messaging +import oslo_messaging _DEFAULT_AUTH_METHODS = ['external', 'password', 'token'] @@ -967,7 +967,7 @@ FILE_OPTIONS = { CONF = cfg.CONF -messaging.set_transport_defaults(control_exchange='keystone') +oslo_messaging.set_transport_defaults(control_exchange='keystone') def _register_auth_plugin_opt(conf, option): diff --git a/keystone/hacking/checks.py b/keystone/hacking/checks.py index 3b856060d2..0ddf219c32 100644 --- a/keystone/hacking/checks.py +++ b/keystone/hacking/checks.py @@ -399,8 +399,8 @@ class CheckForLoggingIssues(BaseASTChecker): def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( - r"(((from)|(import))\s+oslo\.((serialization)|(utils)))|" - "(from\s+oslo\s+import\s+((serialization)|(utils)))") + r"(((from)|(import))\s+oslo\.((messaging)|(serialization)|(utils)))|" + "(from\s+oslo\s+import\s+((messaging)|(serialization)|(utils)))") if re.match(oslo_namespace_imports, logical_line): msg = ("K333: '%s' must be used instead of '%s'.") % ( diff --git a/keystone/notifications.py b/keystone/notifications.py index aa487de170..b812d9ed72 100644 --- a/keystone/notifications.py +++ b/keystone/notifications.py @@ -20,7 +20,7 @@ import logging import socket from oslo.config import cfg -from oslo import messaging +import oslo_messaging import pycadf from pycadf import cadftaxonomy as taxonomy from pycadf import cadftype @@ -198,8 +198,9 @@ def _get_notifier(): if _notifier is None: host = CONF.default_publisher_id or socket.gethostname() try: - transport = messaging.get_transport(CONF) - _notifier = messaging.Notifier(transport, "identity.%s" % host) + transport = oslo_messaging.get_transport(CONF) + _notifier = oslo_messaging.Notifier(transport, + "identity.%s" % host) except Exception: LOG.exception(_LE("Failed to construct notifier")) _notifier = False diff --git a/keystone/tests/ksfixtures/hacking.py b/keystone/tests/ksfixtures/hacking.py index d7203699a0..5450f7d01d 100644 --- a/keystone/tests/ksfixtures/hacking.py +++ b/keystone/tests/ksfixtures/hacking.py @@ -196,6 +196,14 @@ class HackingCode(fixtures.Fixture): from oslo import serialization from oslo.serialization import jsonutils from oslo_serialization import jsonutils + + import oslo.messaging + import oslo_messaging + import oslo.messaging.conffixture + import oslo_messaging.conffixture + from oslo import messaging + from oslo.messaging import conffixture + from oslo_messaging import conffixture """, 'expected_errors': [ (1, 0, 'K333'), @@ -206,6 +214,10 @@ class HackingCode(fixtures.Fixture): (11, 0, 'K333'), (13, 0, 'K333'), (14, 0, 'K333'), + (17, 0, 'K333'), + (19, 0, 'K333'), + (21, 0, 'K333'), + (22, 0, 'K333'), ], }