1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Allow pattern[0] to address a single node

Replaces erroring out on it and requiring the abysmal pattern[0-0]
instead.
This commit is contained in:
Daniel Hokka Zakrisson 2013-01-07 18:20:09 +01:00
parent 03ab074d0d
commit c23eda82c2

View file

@ -165,10 +165,11 @@ class Inventory(object):
return (pattern, None)
(first, rest) = pattern.split("[")
rest = rest.replace("]","")
if not "-" in rest:
raise errors.AnsibleError("invalid pattern: %s" % pattern)
(left, right) = rest.split("-",1)
return (first, (left, right))
if "-" in rest:
(left, right) = rest.split("-",1)
return (first, (left, right))
else:
return (first, (rest, rest))
def _apply_ranges(self, pat, hosts):
"""