mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixed regex square-bracket bug.
Regexes were being parsed like ordinary ansible host patterns, so square-bracket groups were getting interpolated wrongly.
This commit is contained in:
parent
dc89cc5f44
commit
307a3e8a9c
1 changed files with 4 additions and 0 deletions
|
@ -235,6 +235,10 @@ class Inventory(object):
|
||||||
a tuple of (start, stop) or None
|
a tuple of (start, stop) or None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Do not parse regexes for enumeration info
|
||||||
|
if pattern.startswith('~'):
|
||||||
|
return (pattern, None)
|
||||||
|
|
||||||
# The regex used to match on the range, which can be [x] or [x-y].
|
# The regex used to match on the range, which can be [x] or [x-y].
|
||||||
pattern_re = re.compile("^(.*)\[([-]?[0-9]+)(?:(?:-)([0-9]+))?\](.*)$")
|
pattern_re = re.compile("^(.*)\[([-]?[0-9]+)(?:(?:-)([0-9]+))?\](.*)$")
|
||||||
m = pattern_re.match(pattern)
|
m = pattern_re.match(pattern)
|
||||||
|
|
Loading…
Reference in a new issue