Merge "kafka: Fix invalid hostaddr format for IPv6 address"
This commit is contained in:
commit
63f95e92c3
@ -125,7 +125,12 @@ class Connection(object):
|
||||
LOG.warning("Different transport usernames detected")
|
||||
|
||||
if host.hostname:
|
||||
self.hostaddrs.append("%s:%s" % (host.hostname, host.port))
|
||||
if ':' in host.hostname:
|
||||
hostaddr = "[%s]:%s" % (host.hostname, host.port)
|
||||
else:
|
||||
hostaddr = "%s:%s" % (host.hostname, host.port)
|
||||
|
||||
self.hostaddrs.append(hostaddr)
|
||||
|
||||
def reset(self):
|
||||
"""Reset a connection so it can be used again."""
|
||||
|
@ -66,6 +66,16 @@ class TestKafkaTransportURL(test_utils.BaseTestCase):
|
||||
username='stack',
|
||||
password='stacksecret',
|
||||
vhost='my_host'))),
|
||||
('ipv4', dict(url='kafka://127.0.0.1:1234',
|
||||
expected=dict(hostaddrs=['127.0.0.1:1234'],
|
||||
username=None,
|
||||
password=None,
|
||||
vhost=None))),
|
||||
('ipv6', dict(url='kafka://[::1]:1234',
|
||||
expected=dict(hostaddrs=['[::1]:1234'],
|
||||
username=None,
|
||||
password=None,
|
||||
vhost=None))),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
|
Loading…
Reference in New Issue
Block a user