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

Getting negative host pattern matching to work with external inventory

(same as commit 4caf85e37b, but for
excluded hosts as well as subsets)
This commit is contained in:
Peter Sankauskas 2012-09-25 16:16:25 -07:00
parent f8a9541405
commit 8a4e969b93

View file

@ -109,8 +109,8 @@ class Inventory(object):
# exclude hosts mentioned in a negative pattern
if len(negative_patterns):
exclude_hosts = self._get_hosts(negative_patterns)
hosts = [ h for h in hosts if h not in exclude_hosts ]
exclude_hosts = [ h.name for h in self._get_hosts(negative_patterns) ]
hosts = [ h for h in hosts if h.name not in exclude_hosts ]
# exclude hosts not in a subset, if defined
if self._subset: