Merge pull request #51290 from s0undt3ch/hotfix/fix-network

[2018.3.4] Fix minion start
This commit is contained in:
Pedro Algarvio 2019-01-25 15:14:46 +00:00 committed by GitHub
commit e90ca1d63c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -1935,7 +1935,7 @@ def parse_host_port(host_port):
if _s_[0] == "[": if _s_[0] == "[":
if "]" in host_port: if "]" in host_port:
host, _s_ = _s_.lstrip("[").rsplit("]", 1) host, _s_ = _s_.lstrip("[").rsplit("]", 1)
host = ipaddress.IPv6Address(host) host = ipaddress.IPv6Address(host).compressed
if _s_[0] == ":": if _s_[0] == ":":
port = int(_s_.lstrip(":")) port = int(_s_.lstrip(":"))
else: else:
@ -1953,7 +1953,7 @@ def parse_host_port(host_port):
host = _s_ host = _s_
try: try:
if not isinstance(host, ipaddress._BaseAddress): if not isinstance(host, ipaddress._BaseAddress):
host_ip = ipaddress.ip_address(host) host_ip = ipaddress.ip_address(host).compressed
host = host_ip host = host_ip
except ValueError: except ValueError:
log.debug('"%s" Not an IP address? Assuming it is a hostname.', host) log.debug('"%s" Not an IP address? Assuming it is a hostname.', host)

View File

@ -206,12 +206,12 @@ class NetworkTestCase(TestCase):
def test_parse_host_port(self): def test_parse_host_port(self):
_ip = ipaddress.ip_address _ip = ipaddress.ip_address
good_host_ports = { good_host_ports = {
'10.10.0.3': (_ip('10.10.0.3'), None), '10.10.0.3': (_ip('10.10.0.3').compressed, None),
'10.10.0.3:1234': (_ip('10.10.0.3'), 1234), '10.10.0.3:1234': (_ip('10.10.0.3').compressed, 1234),
'2001:0db8:85a3::8a2e:0370:7334': (_ip('2001:0db8:85a3::8a2e:0370:7334'), None), '2001:0db8:85a3::8a2e:0370:7334': (_ip('2001:0db8:85a3::8a2e:0370:7334').compressed, None),
'[2001:0db8:85a3::8a2e:0370:7334]:1234': (_ip('2001:0db8:85a3::8a2e:0370:7334'), 1234), '[2001:0db8:85a3::8a2e:0370:7334]:1234': (_ip('2001:0db8:85a3::8a2e:0370:7334').compressed, 1234),
'2001:0db8:85a3::7334': (_ip('2001:0db8:85a3::7334'), None), '2001:0db8:85a3::7334': (_ip('2001:0db8:85a3::7334').compressed, None),
'[2001:0db8:85a3::7334]:1234': (_ip('2001:0db8:85a3::7334'), 1234) '[2001:0db8:85a3::7334]:1234': (_ip('2001:0db8:85a3::7334').compressed, 1234)
} }
bad_host_ports = [ bad_host_ports = [
'10.10.0.3/24', '10.10.0.3/24',