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) return (pattern, None)
(first, rest) = pattern.split("[") (first, rest) = pattern.split("[")
rest = rest.replace("]","") rest = rest.replace("]","")
if not "-" in rest: if "-" in rest:
raise errors.AnsibleError("invalid pattern: %s" % pattern) (left, right) = rest.split("-",1)
(left, right) = rest.split("-",1) return (first, (left, right))
return (first, (left, right)) else:
return (first, (rest, rest))
def _apply_ranges(self, pat, hosts): def _apply_ranges(self, pat, hosts):
""" """