mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #3275 from madduck/implicit-negations
Enable negated patterns
This commit is contained in:
commit
2bbad5dae3
1 changed files with 5 additions and 0 deletions
|
@ -136,6 +136,11 @@ class Inventory(object):
|
||||||
finds hosts that match a list of patterns. Handles negative
|
finds hosts that match a list of patterns. Handles negative
|
||||||
matches as well as intersection matches.
|
matches as well as intersection matches.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
if patterns[0].startswith("!"):
|
||||||
|
patterns.insert(0, "all")
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
|
||||||
hosts = set()
|
hosts = set()
|
||||||
for p in patterns:
|
for p in patterns:
|
||||||
|
|
Loading…
Reference in a new issue