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:
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)
|
||||
(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):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue