Merge branch '2018.3' into 51673_multiple_file_sections_with_excludes

This commit is contained in:
Gareth J. Greenaway 2019-03-01 11:40:07 -08:00 committed by GitHub
commit 58ef51db75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -150,7 +150,6 @@ class IPv6AddressScoped(ipaddress.IPv6Address):
# and we need check this differently anyway
self._is_packed_binary = lambda p: isinstance(p, bytes)
# pylint: enable-all
if isinstance(address, string_types) and '%' in address:
buff = address.split('%')
if len(buff) != 2:
@ -189,7 +188,7 @@ class IPv6AddressScoped(ipaddress.IPv6Address):
:return:
'''
packed = False
if len(data) == 16 and ':' not in data:
if isinstance(data, bytes) and len(data) == 16 and b':' not in data:
try:
packed = bool(int(str(bytearray(data)).encode('hex'), 16))
except ValueError:

View File

@ -185,11 +185,17 @@ class NetworkTestCase(TestCase):
def test_is_ip(self):
self.assertTrue(network.is_ip('10.10.0.3'))
self.assertFalse(network.is_ip('0.9.800.1000'))
# Check 16-char-long unicode string
# https://github.com/saltstack/salt/issues/51258
self.assertFalse(network.is_ipv6('sixteen-char-str'))
def test_is_ipv4(self):
self.assertTrue(network.is_ipv4('10.10.0.3'))
self.assertFalse(network.is_ipv4('10.100.1'))
self.assertFalse(network.is_ipv4('2001:db8:0:1:1:1:1:1'))
# Check 16-char-long unicode string
# https://github.com/saltstack/salt/issues/51258
self.assertFalse(network.is_ipv4('sixteen-char-str'))
def test_is_ipv6(self):
self.assertTrue(network.is_ipv6('2001:db8:0:1:1:1:1:1'))
@ -202,6 +208,9 @@ class NetworkTestCase(TestCase):
self.assertFalse(network.is_ipv6('2001:0db8:::0370:7334'))
self.assertFalse(network.is_ipv6('10.0.1.2'))
self.assertFalse(network.is_ipv6('2001.0db8.85a3.0000.0000.8a2e.0370.7334'))
# Check 16-char-long unicode string
# https://github.com/saltstack/salt/issues/51258
self.assertFalse(network.is_ipv6('sixteen-char-str'))
def test_parse_host_port(self):
_ip = ipaddress.ip_address