Return results even when the cache is disabled (#55505)

* Return results even when the cache is disabled

By default the cache is disabled and so the results of the API call
are not placed in there for the return statement to fetch.

* Always update self._cache to return
This commit is contained in:
Matt Williams 2019-05-28 18:44:00 +01:00 committed by Brian Coca
parent a837cc5694
commit cf00883c9d
2 changed files with 3 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Fix foreman inventory plugin when inventory caching is disabled

View file

@ -162,9 +162,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
# get next page # get next page
params['page'] += 1 params['page'] += 1
# Set the cache if it is enabled or if the cache was refreshed self._cache[self.cache_key][url] = results
if self.use_cache or self.get_option('cache'):
self._cache[self.cache_key][url] = results
return self._cache[self.cache_key][url] return self._cache[self.cache_key][url]