mirror of
https://github.com/ansible/ansible.git
synced 2026-08-01 00:34:56 +02:00
Fixed ipv6 pattern in parse_address (#84237)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- Fix ipv6 pattern bug in lib/ansible/parsing/utils/addresses.py (https://github.com/ansible/ansible/issues/84237)
|
||||
@@ -126,7 +126,7 @@ patterns = {
|
||||
|
||||
'ipv6': re.compile(
|
||||
r"""^
|
||||
(?:{0}:){{7}}{0}| # uncompressed: 1:2:3:4:5:6:7:8
|
||||
((?:{0}:){{7}}{0}| # uncompressed: 1:2:3:4:5:6:7:8
|
||||
(?:{0}:){{1,6}}:| # compressed variants, which are all
|
||||
(?:{0}:)(?::{0}){{1,6}}| # a::b for various lengths of a,b
|
||||
(?:{0}:){{2}}(?::{0}){{1,5}}|
|
||||
@@ -139,7 +139,7 @@ patterns = {
|
||||
# ipv4-in-ipv6 variants
|
||||
(?:0:){{6}}(?:{0}\.){{3}}{0}|
|
||||
::(?:ffff:)?(?:{0}\.){{3}}{0}|
|
||||
(?:0:){{5}}ffff:(?:{0}\.){{3}}{0}
|
||||
(?:0:){{5}}ffff:(?:{0}\.){{3}}{0})
|
||||
$
|
||||
""".format(ipv6_component), re.X | re.I
|
||||
),
|
||||
|
||||
@@ -34,6 +34,8 @@ class TestParseAddress(unittest.TestCase):
|
||||
'::ffff:1.2.3.4': ['::ffff:1.2.3.4', None],
|
||||
'::1.2.3.4': ['::1.2.3.4', None],
|
||||
'1234::': ['1234::', None],
|
||||
# Invalid IPv6 address
|
||||
'1234::9abc:def0:1234:5678:9abc::::::::def0': [None, None],
|
||||
|
||||
# Hostnames
|
||||
'some-host': ['some-host', None],
|
||||
|
||||
Reference in New Issue
Block a user