diff --git a/lib/ansible/parsing/utils/addresses.py b/lib/ansible/parsing/utils/addresses.py index 294025e3dd..387f05c627 100644 --- a/lib/ansible/parsing/utils/addresses.py +++ b/lib/ansible/parsing/utils/addresses.py @@ -31,6 +31,13 @@ numeric_range = r''' \] ''' +hexadecimal_range = r''' + \[ + (?:[0-9a-f]+:[0-9a-f]+) # hexadecimal begin:end + (?::[0-9]+)? # numeric :step (optional) + \] +''' + alphanumeric_range = r''' \[ (?: @@ -50,7 +57,7 @@ ipv6_component = r''' [0-9a-f]{{1,4}}| # 0..ffff {range} # or a numeric range ) -'''.format(range=numeric_range) +'''.format(range=hexadecimal_range) ipv4_component = r''' (?: diff --git a/test/units/parsing/test_addresses.py b/test/units/parsing/test_addresses.py index 8f4fe3696e..bb6e51b22a 100644 --- a/test/units/parsing/test_addresses.py +++ b/test/units/parsing/test_addresses.py @@ -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],