Skip to content

Commit

Permalink
Merge pull request ansible#12424 from amenonsen/ipv6-ranges
Browse files Browse the repository at this point in the history
Tested.  Thanks for spotting and then fixing this -- Allow hexadecimal ranges in IPv6 addresses, not only 0-9
  • Loading branch information
chrrrles committed Sep 17, 2015
2 parents b386f0c + 2d420a9 commit 7b778d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ansible/parsing/utils/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
\]
'''

hexadecimal_range = r'''
\[
(?:[0-9a-f]+:[0-9a-f]+) # hexadecimal begin:end
(?::[0-9]+)? # numeric :step (optional)
\]
'''

alphanumeric_range = r'''
\[
(?:
Expand All @@ -50,7 +57,7 @@
[0-9a-f]{{1,4}}| # 0..ffff
{range} # or a numeric range
)
'''.format(range=numeric_range)
'''.format(range=hexadecimal_range)

ipv4_component = r'''
(?:
Expand Down
1 change: 1 addition & 0 deletions test/units/parsing/test_addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TestParseAddress(unittest.TestCase):
'192.0.2.[3:10]:23': ['192.0.2.[3:10]', 23],
'abcd:ef98::7654:[1:9]': ['abcd:ef98::7654:[1:9]', None],
'[abcd:ef98::7654:[6:32]]:2222': ['abcd:ef98::7654:[6:32]', 2222],
'[abcd:ef98::7654:[9ab3:fcb7]]:2222': ['abcd:ef98::7654:[9ab3:fcb7]', 2222],
u'fóöb[a:c]r.éxàmplê.com:632': [u'fóöb[a:c]r.éxàmplê.com', 632],
'[a:b]foo.com': ['[a:b]foo.com', None],
'foo[a:b].com': ['foo[a:b].com', None],
Expand Down

0 comments on commit 7b778d8

Please sign in to comment.