Update inventory caching to remove deprecation warnings (#53976)

This commit is contained in:
Sloane Hertel 2019-03-26 08:15:12 -05:00 committed by GitHub
parent 1a5732807f
commit a93154c57f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 14 deletions

View file

@ -583,7 +583,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
cache_needs_update = False
if cache:
try:
results = self.cache.get(cache_key)
results = self._cache[cache_key]
except KeyError:
# if cache expires or cache file doesn't exist
cache_needs_update = True
@ -596,7 +596,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
# If the cache has expired/doesn't exist or if refresh_inventory/flush cache is used
# when the user is using caching, update the cached inventory
if cache_needs_update or (not cache and self.get_option('cache')):
self.cache.set(cache_key, results)
self._cache[cache_key] = results
@staticmethod
def _legacy_script_compatible_group_sanitization(name):