From fc9b44e021511b40dcc3dd3c402ccbf6aabfb03e Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 15 Sep 2017 15:13:43 -0400 Subject: [PATCH] clear correct cache when reconcile is invoked moved it to ensure all callers get the correct hosts after --- lib/ansible/inventory/manager.py | 1 + lib/ansible/plugins/strategy/__init__.py | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index f04f1c65e41..a3c02277c5b 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -168,6 +168,7 @@ class InventoryManager(object): return self._inventory.get_groups_dict() def reconcile_inventory(self): + self.clear_caches() return self._inventory.reconcile_inventory() def get_host(self, hostname): diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index 4e54fcaf2a0..6937e6f7231 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -615,9 +615,6 @@ class StrategyBase: new_group = self._inventory.groups[group_name] new_group.add_host(self._inventory.hosts[host_name]) - # clear pattern caching completely since it's unpredictable what patterns may have referenced the group - self._inventory.clear_pattern_cache() - # reconcile inventory, ensures inventory rules are followed self._inventory.reconcile_inventory() @@ -655,7 +652,6 @@ class StrategyBase: changed = True if changed: - self._inventory.clear_pattern_cache() self._inventory.reconcile_inventory() return changed