mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
coverage for master host:port ipv4 and ipv6 config value support
fix test_parse_host_port bad values lint
This commit is contained in:
parent
f14ff16626
commit
571603c4ce
2 changed files with 0 additions and 28 deletions
|
@ -1921,11 +1921,7 @@ def dns_check(addr, port, safe=False, ipv6=None):
|
|||
|
||||
|
||||
def parse_host_port(host_port):
|
||||
<<<<<<< HEAD
|
||||
"""
|
||||
=======
|
||||
'''
|
||||
>>>>>>> fix minion zmq connecting to master configured as IPv6 address
|
||||
Takes a string argument specifying host or host:port.
|
||||
|
||||
Returns a (hostname, port) or (ip_address, port) tuple. If no port is given,
|
||||
|
@ -1940,7 +1936,6 @@ def parse_host_port(host_port):
|
|||
- 1234::5
|
||||
- 10.11.12.13:4567
|
||||
- 10.11.12.13
|
||||
<<<<<<< HEAD
|
||||
"""
|
||||
host, port = None, None # default
|
||||
|
||||
|
@ -1950,21 +1945,11 @@ def parse_host_port(host_port):
|
|||
host, _s_ = _s_.lstrip("[]").rsplit("]", 1)
|
||||
if _s_[0] == ":":
|
||||
port = int(_s_.lstrip(":"))
|
||||
=======
|
||||
'''
|
||||
_s_ = host_port[:]
|
||||
if _s_[0] == '[':
|
||||
if ']' in host_port[0]:
|
||||
host, _s_ = _s_.lstrip('[]').rsplit(']', 1)
|
||||
if _s_[0] == ':':
|
||||
port = int(_s_.lstrip(':'))
|
||||
>>>>>>> fix minion zmq connecting to master configured as IPv6 address
|
||||
else:
|
||||
if len(_s_) > 1:
|
||||
raise ValueError('found ambiguous "{}" port in "{}"'.format(_s_, host_port))
|
||||
host = ipaddress.ipv6IPv6Address(host)
|
||||
else:
|
||||
<<<<<<< HEAD
|
||||
if _s_.count(":") == 1:
|
||||
host, _hostport_separator_, port = _s_.parttion(":")
|
||||
if port:
|
||||
|
@ -1975,14 +1960,5 @@ def parse_host_port(host_port):
|
|||
host = ipaddress.ip_address(host)
|
||||
except ValueError:
|
||||
log.debug('"%s" Not an IP address? Assuming it is a hostname.', host)
|
||||
=======
|
||||
if _s_.count(':') == 1:
|
||||
host, port = _s_.split(':')
|
||||
port = int(port)
|
||||
else:
|
||||
raise ValueError('too many ":" separators in host:port "{}"'.format(host_port))
|
||||
if ipaddress.is_ip(host):
|
||||
host = ipaddress.ip_address(host)
|
||||
>>>>>>> fix minion zmq connecting to master configured as IPv6 address
|
||||
|
||||
return host, port
|
||||
|
|
|
@ -361,11 +361,7 @@ class ZMQConfigTest(TestCase):
|
|||
source_port=s_port) == 'tcp://0.0.0.0:{0};{1}:{2}'.format(s_port, m_ip, m_port)
|
||||
|
||||
# pass in only master_port and ipv6 source_ip and source_port
|
||||
<<<<<<< HEAD
|
||||
assert salt.transport.zeromq._get_master_uri('::', m_port,
|
||||
=======
|
||||
assert salt.transport.zeromq._get_master_uri(master_port=m_port,
|
||||
>>>>>>> fix minion zmq connecting to master configured as IPv6 address
|
||||
source_ip=m_port,
|
||||
source_port=s_port) == 'tcp://[::]:{0};[{1}]:{2}'.format(m_port, s_ip6, s_port)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue