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:
parent
03ab074d0d
commit
c23eda82c2
1 changed files with 5 additions and 4 deletions
|
@ -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)
|
||||
if "-" in rest:
|
||||
(left, right) = rest.split("-",1)
|
||||
return (first, (left, right))
|
||||
else:
|
||||
return (first, (rest, rest))
|
||||
|
||||
def _apply_ranges(self, pat, hosts):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue