summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjamessewell <james.sewell@gmail.com>2016-11-19 06:27:17 +1100
committerJames Cammarata <jimi@sngx.net>2016-11-18 13:28:27 -0600
commita36ac1ad1b01256041be5033d40c68554fb96f12 (patch)
treec4c83ea92870da01217cdd1eb80af93454da3502
parentd6ab3699160d3ded0811eb487963e5e4cdb947be (diff)
downloadansible-a36ac1ad1b01256041be5033d40c68554fb96f12.tar.gz
Moved the _inventory.clear_group_dict_cache() from creating a group w… (#17766)
* Moved the _inventory.clear_group_dict_cache() from creating a group which doesn't exist, to adding members to the group. * Update __init__.py Update to use changed: block to catch all changes for cache clear as suggested (cherry picked from commit b91d4d884d14101bc526ced4457bd02c1bd78ef6)
-rw-r--r--lib/ansible/plugins/strategy/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py
index 4f867ff49c..c831ae4752 100644
--- a/lib/ansible/plugins/strategy/__init__.py
+++ b/lib/ansible/plugins/strategy/__init__.py
@@ -559,6 +559,10 @@ class StrategyBase:
if group_name not in host.get_groups():
new_group.add_host(real_host)
changed = True
+
+ if changed:
+ # clear cache of group dict, which is used in magic host variables
+ self._inventory.clear_group_dict_cache()
return changed