From 8a4e969b93d722546f4fb1a58e9f2e4dd93b9879 Mon Sep 17 00:00:00 2001 From: Peter Sankauskas Date: Tue, 25 Sep 2012 16:16:25 -0700 Subject: [PATCH] Getting negative host pattern matching to work with external inventory (same as commit 4caf85e37bdff284c337086ff3ce46b1dcfd8751, but for excluded hosts as well as subsets) --- lib/ansible/inventory/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index a5780c19826..3e0f44859ae 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -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: