Merge "Properly handle transport:///vhost URL"
This commit is contained in:
commit
18a11da1dc
@ -291,21 +291,20 @@ class AMQPDriverBase(base.BaseDriver):
|
||||
self._waiter = None
|
||||
|
||||
def _server_params_from_url(self, url):
|
||||
if not url.hosts:
|
||||
return None
|
||||
sp = {}
|
||||
|
||||
sp = {
|
||||
'virtual_host': url.virtual_host,
|
||||
}
|
||||
if url.virtual_host is not None:
|
||||
sp['virtual_host'] = url.virtual_host
|
||||
|
||||
# FIXME(markmc): support multiple hosts
|
||||
host = url.hosts[0]
|
||||
if url.hosts:
|
||||
# FIXME(markmc): support multiple hosts
|
||||
host = url.hosts[0]
|
||||
|
||||
sp['hostname'] = host.hostname
|
||||
if host.port is not None:
|
||||
sp['port'] = host.port
|
||||
sp['username'] = host.username or ''
|
||||
sp['password'] = host.password or ''
|
||||
sp['hostname'] = host.hostname
|
||||
if host.port is not None:
|
||||
sp['port'] = host.port
|
||||
sp['username'] = host.username or ''
|
||||
sp['password'] = host.password or ''
|
||||
|
||||
return sp
|
||||
|
||||
|
@ -48,14 +48,19 @@ class TestRabbitDriverLoad(test_utils.BaseTestCase):
|
||||
class TestRabbitTransportURL(test_utils.BaseTestCase):
|
||||
|
||||
scenarios = [
|
||||
('none', dict(url=None, expected=None)),
|
||||
('empty', dict(url='rabbit:///', expected=None)),
|
||||
('none', dict(url=None, expected={})),
|
||||
('empty',
|
||||
dict(url='rabbit:///',
|
||||
expected=dict(virtual_host=''))),
|
||||
('localhost',
|
||||
dict(url='rabbit://localhost/',
|
||||
expected=dict(hostname='localhost',
|
||||
username='',
|
||||
password='',
|
||||
virtual_host=''))),
|
||||
('virtual_host',
|
||||
dict(url='rabbit:///vhost',
|
||||
expected=dict(virtual_host='vhost'))),
|
||||
('no_creds',
|
||||
dict(url='rabbit://host/virtual_host',
|
||||
expected=dict(hostname='host',
|
||||
|
Loading…
x
Reference in New Issue
Block a user