Fix oslo.messaging default transport
Change d3f6ca0b47
have broken
oslo.messaging defaults, no more transport are selected by default and
oslo.messaging just crash:
Traceback (most recent call last):
File "/home/sileht/workspace/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
File "oslo_messaging/tests/test_transport.py", line 111, in test_get_transport
transport_ = oslo_messaging.get_transport(self.conf, **kwargs)
File "/home/sileht/workspace/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/debtcollector/removals.py", line 242, in wrapper
return f(*args, **kwargs)
File "oslo_messaging/transport.py", line 247, in get_transport
transport_cls=RPCTransport)
File "oslo_messaging/transport.py", line 205, in _get_transport
url.transport.split('+')[0],
AttributeError: 'NoneType' object has no attribute 'split'
This change restores rabbit:// as default.
Change-Id: I945a2aca60347dad672cc406cd33e80e93c588a7
This commit is contained in:
parent
95b487ba6b
commit
172cfb33f3
@ -51,6 +51,13 @@ class _FakeManager(object):
|
|||||||
class GetTransportTestCase(test_utils.BaseTestCase):
|
class GetTransportTestCase(test_utils.BaseTestCase):
|
||||||
|
|
||||||
scenarios = [
|
scenarios = [
|
||||||
|
('default',
|
||||||
|
dict(url=None, transport_url=None,
|
||||||
|
control_exchange=None, allowed=None,
|
||||||
|
expect=dict(backend='rabbit',
|
||||||
|
exchange=None,
|
||||||
|
url='rabbit:',
|
||||||
|
allowed=[]))),
|
||||||
('transport_url',
|
('transport_url',
|
||||||
dict(url=None, transport_url='testtransport:',
|
dict(url=None, transport_url='testtransport:',
|
||||||
control_exchange=None, allowed=None,
|
control_exchange=None, allowed=None,
|
||||||
@ -83,8 +90,10 @@ class GetTransportTestCase(test_utils.BaseTestCase):
|
|||||||
|
|
||||||
@mock.patch('oslo_messaging.transport.LOG')
|
@mock.patch('oslo_messaging.transport.LOG')
|
||||||
def test_get_transport(self, fake_logger):
|
def test_get_transport(self, fake_logger):
|
||||||
self.config(control_exchange=self.control_exchange,
|
self.messaging_conf.reset()
|
||||||
transport_url=self.transport_url)
|
self.config(control_exchange=self.control_exchange)
|
||||||
|
if self.transport_url:
|
||||||
|
self.config(transport_url=self.transport_url)
|
||||||
|
|
||||||
driver.DriverManager = mock.Mock()
|
driver.DriverManager = mock.Mock()
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
_transport_opts = [
|
_transport_opts = [
|
||||||
cfg.StrOpt('transport_url',
|
cfg.StrOpt('transport_url',
|
||||||
|
default="rabbit://",
|
||||||
secret=True,
|
secret=True,
|
||||||
help='The network address and optional user credentials for '
|
help='The network address and optional user credentials for '
|
||||||
'connecting to the messaging backend, in URL format. The '
|
'connecting to the messaging backend, in URL format. The '
|
||||||
@ -443,8 +444,6 @@ class TransportURL(object):
|
|||||||
if not url:
|
if not url:
|
||||||
conf.register_opts(_transport_opts)
|
conf.register_opts(_transport_opts)
|
||||||
url = url or conf.transport_url
|
url = url or conf.transport_url
|
||||||
if not url:
|
|
||||||
return cls(conf)
|
|
||||||
|
|
||||||
if not isinstance(url, six.string_types):
|
if not isinstance(url, six.string_types):
|
||||||
raise InvalidTransportURL(url, 'Wrong URL type')
|
raise InvalidTransportURL(url, 'Wrong URL type')
|
||||||
|
Loading…
Reference in New Issue
Block a user