Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo' namespace package into per-library packages. The namespace package was retained during kilo for backwards compatibility, but will be removed by the liberty-2 milestone. This change removes the use of the namespace package, replacing it with the new package names. The patches in the libraries will be put on hold until application patches have landed, or L2, whichever comes first. At that point, new versions of the libraries without namespace packages will be released as a major version update. Please merge this patch, or an equivalent, before L2 to avoid problems with those library releases. Blueprint: remove-namespace-packages https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages Change-Id: I977248bec9560bcd730efe6bed741f1dc025fdf3
This commit is contained in:
parent
1e19e6e64a
commit
59f1b00e68
|
@ -30,7 +30,7 @@ import sys
|
|||
from oslo_config import cfg
|
||||
from oslo_context import context
|
||||
try:
|
||||
import oslo.messaging
|
||||
import oslo_messaging
|
||||
messaging = True
|
||||
except ImportError:
|
||||
messaging = False
|
||||
|
@ -322,8 +322,8 @@ class AuditMiddleware(object):
|
|||
|
||||
transport_aliases = self._get_aliases(cfg.CONF.project)
|
||||
if messaging:
|
||||
self._notifier = oslo.messaging.Notifier(
|
||||
oslo.messaging.get_transport(cfg.CONF,
|
||||
self._notifier = oslo_messaging.Notifier(
|
||||
oslo_messaging.get_transport(cfg.CONF,
|
||||
aliases=transport_aliases),
|
||||
os.path.basename(sys.argv[0]))
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html .
|
|||
|
||||
"""
|
||||
|
||||
from oslo import i18n
|
||||
import oslo_i18n as i18n
|
||||
|
||||
|
||||
_translators = i18n.TranslatorFactory(domain='keystonemiddleware')
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
import copy
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
|
||||
memcache_opts = [
|
||||
cfg.ListOpt('memcached_servers',
|
||||
|
|
|
@ -90,13 +90,13 @@ class BaseAuditMiddlewareTest(testtools.TestCase):
|
|||
return env_headers
|
||||
|
||||
|
||||
@mock.patch('oslo.messaging.get_transport', mock.MagicMock())
|
||||
@mock.patch('oslo_messaging.get_transport', mock.MagicMock())
|
||||
class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
||||
|
||||
def test_api_request(self):
|
||||
req = webob.Request.blank('/foo/bar',
|
||||
environ=self.get_environ_header('GET'))
|
||||
with mock.patch('oslo.messaging.Notifier.info') as notify:
|
||||
with mock.patch('oslo_messaging.Notifier.info') as notify:
|
||||
self.middleware(req)
|
||||
# Check first notification with only 'request'
|
||||
call_args = notify.call_args_list[0][0]
|
||||
|
@ -121,7 +121,7 @@ class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
|||
service_name='pycadf')
|
||||
req = webob.Request.blank('/foo/bar',
|
||||
environ=self.get_environ_header('GET'))
|
||||
with mock.patch('oslo.messaging.Notifier.info') as notify:
|
||||
with mock.patch('oslo_messaging.Notifier.info') as notify:
|
||||
try:
|
||||
self.middleware(req)
|
||||
self.fail('Application exception has not been re-raised')
|
||||
|
@ -144,7 +144,7 @@ class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
|||
def test_process_request_fail(self):
|
||||
req = webob.Request.blank('/foo/bar',
|
||||
environ=self.get_environ_header('GET'))
|
||||
with mock.patch('oslo.messaging.Notifier.info',
|
||||
with mock.patch('oslo_messaging.Notifier.info',
|
||||
side_effect=Exception('error')) as notify:
|
||||
self.middleware._process_request(req)
|
||||
self.assertTrue(notify.called)
|
||||
|
@ -152,7 +152,7 @@ class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
|||
def test_process_response_fail(self):
|
||||
req = webob.Request.blank('/foo/bar',
|
||||
environ=self.get_environ_header('GET'))
|
||||
with mock.patch('oslo.messaging.Notifier.info',
|
||||
with mock.patch('oslo_messaging.Notifier.info',
|
||||
side_effect=Exception('error')) as notify:
|
||||
self.middleware._process_response(req, webob.response.Response())
|
||||
self.assertTrue(notify.called)
|
||||
|
@ -167,7 +167,7 @@ class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
|||
environ=self.get_environ_header('PUT'))
|
||||
req2 = webob.Request.blank('/accept/foo',
|
||||
environ=self.get_environ_header('POST'))
|
||||
with mock.patch('oslo.messaging.Notifier.info') as notify:
|
||||
with mock.patch('oslo_messaging.Notifier.info') as notify:
|
||||
# Check GET/PUT request does not send notification
|
||||
self.middleware(req)
|
||||
self.middleware(req1)
|
||||
|
@ -207,7 +207,7 @@ class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
|||
service_name='pycadf')
|
||||
req = webob.Request.blank('/foo/bar',
|
||||
environ=self.get_environ_header('GET'))
|
||||
with mock.patch('oslo.messaging.Notifier.info') as notify:
|
||||
with mock.patch('oslo_messaging.Notifier.info') as notify:
|
||||
middleware(req)
|
||||
self.assertIsNotNone(req.environ.get('cadf_event'))
|
||||
|
||||
|
@ -222,13 +222,13 @@ class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
|||
service_name='pycadf')
|
||||
req = webob.Request.blank('/foo/bar',
|
||||
environ=self.get_environ_header('GET'))
|
||||
with mock.patch('oslo.messaging.Notifier.info',
|
||||
with mock.patch('oslo_messaging.Notifier.info',
|
||||
side_effect=Exception('error')) as notify:
|
||||
middleware._process_request(req)
|
||||
self.assertTrue(notify.called)
|
||||
req2 = webob.Request.blank('/foo/bar',
|
||||
environ=self.get_environ_header('GET'))
|
||||
with mock.patch('oslo.messaging.Notifier.info') as notify:
|
||||
with mock.patch('oslo_messaging.Notifier.info') as notify:
|
||||
middleware._process_response(req2, webob.response.Response())
|
||||
self.assertTrue(notify.called)
|
||||
# ensure event is not the same across requests
|
||||
|
@ -236,7 +236,7 @@ class AuditMiddlewareTest(BaseAuditMiddlewareTest):
|
|||
notify.call_args_list[0][0][2]['id'])
|
||||
|
||||
|
||||
@mock.patch('oslo.messaging', mock.MagicMock())
|
||||
@mock.patch('oslo_messaging.rpc', mock.MagicMock())
|
||||
class AuditApiLogicTest(BaseAuditMiddlewareTest):
|
||||
|
||||
def api_request(self, method, url):
|
||||
|
|
Loading…
Reference in New Issue