summaryrefslogtreecommitdiff
path: root/lib/ansible/inventory
diff options
context:
space:
mode:
authorSloane Hertel <shertel@redhat.com>2019-03-06 12:12:35 -0600
committerGitHub <noreply@github.com>2019-03-06 12:12:35 -0600
commit96878798400e709ac61c9216a97cee46ad101e75 (patch)
tree1e4f64a4542e00c8b3cd4f678067de2be7a3a007 /lib/ansible/inventory
parent831f068f984e068ebae436471e12a7d4d3dc7431 (diff)
downloadansible-96878798400e709ac61c9216a97cee46ad101e75.tar.gz
Fix inventory cache interface (#50446)
* Replace InventoryFileCacheModule with a better developer-interface Use new interface for inventory plugins with backwards compatibility Auto-update the backing cache-plugin if the cache has changed after parsing the inventory plugin * Update CacheModules to use the config system and add a deprecation warning if they are being imported directly rather than using cache_loader * Fix foreman inventory caching * Add tests * Add integration test to check that fact caching works normally with cache plugins using ansible.constants and inventory caching provides a helpful error for non-compatible cache plugins * Add some developer documentation for inventory and cache plugins * Add user documentation for inventory caching * Add deprecation docs * Apply suggestions from docs review * Add changelog
Diffstat (limited to 'lib/ansible/inventory')
-rw-r--r--lib/ansible/inventory/manager.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py
index 7876786c39..c08e4b8c19 100644
--- a/lib/ansible/inventory/manager.py
+++ b/lib/ansible/inventory/manager.py
@@ -270,6 +270,8 @@ class InventoryManager(object):
try:
# FIXME in case plugin fails 1/2 way we have partial inventory
plugin.parse(self._inventory, self._loader, source, cache=cache)
+ if getattr(plugin, '_cache', None):
+ plugin.update_cache_if_changed()
parsed = True
display.vvv('Parsed %s inventory source with %s plugin' % (source, plugin_name))
break