Merge branch '2019.2.0.rc1' into merge_context

This commit is contained in:
Megan Wilhite 2019-01-24 11:09:57 -05:00 committed by GitHub
commit 9d487f20ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View File

@ -144,13 +144,6 @@ class IPv6AddressScoped(ipaddress.IPv6Address):
:param address:
'''
# pylint: disable-all
if not hasattr(self, '_is_packed_binary'):
# This method (below) won't be around for some Python 3 versions
# 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 +182,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

@ -46,6 +46,7 @@ AUTH_INTERNAL_KEYWORDS = frozenset([
'gather_job_timeout',
'kwarg',
'match',
'metadata',
'print_event',
'raw',
'yield_pub_data'

View File

@ -184,11 +184,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'))
@ -201,6 +207,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_is_subnet(self):
for subnet_data in (IPV4_SUBNETS, IPV6_SUBNETS):