summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2017-09-15 15:13:43 -0400
committerToshio Kuratomi <a.badger@gmail.com>2017-09-15 12:59:03 -0700
commita725b62f51ddf080d9ff362593dd01aa53c70fcb (patch)
tree6d6682b8552b5e6f543873b897381beeb069b317
parenteeba9985924764090d1789617b674ca79108763d (diff)
downloadansible-a725b62f51ddf080d9ff362593dd01aa53c70fcb.tar.gz
clear correct cache when reconcile is invoked
moved it to ensure all callers get the correct hosts after (cherry picked from commit fc9b44e021511b40dcc3dd3c402ccbf6aabfb03e)
-rw-r--r--lib/ansible/inventory/manager.py1
-rw-r--r--lib/ansible/plugins/strategy/__init__.py4
2 files changed, 1 insertions, 4 deletions
diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py
index f04f1c65e4..a3c02277c5 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 4e54fcaf2a..6937e6f723 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