Fix --limit for external inventory scripts, slight variant on fix from pull #949

This commit is contained in:
Michael DeHaan 2012-08-27 21:49:12 -04:00
parent 4002cfbdcd
commit 4caf85e37b

View file

@ -114,11 +114,11 @@ class Inventory(object):
positive_subsetp = [ p for p in self._subset if not p.startswith("!") ]
negative_subsetp = [ p for p in self._subset if p.startswith("!") ]
if len(positive_subsetp):
positive_subset = self._get_hosts(positive_subsetp)
hosts = [ h for h in hosts if (h in positive_subset) ]
positive_subset = [ h.name for h in self._get_hosts(positive_subsetp) ]
hosts = [ h for h in hosts if (h.name in positive_subset) ]
if len(negative_subsetp):
negative_subset = self._get_hosts(negative_subsetp)
hosts = [ h for h in hosts if (h not in negative_subset)]
negative_subset = [ h.name for h in self._get_hosts(negative_subsetp) ]
hosts = [ h for h in hosts if (h.name not in negative_subset)]
# exclude hosts mentioned in any restriction (ex: failed hosts)
if self._restriction is not None: