1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-20 10:48:59 +00:00

[FIX-11365] Fix nmap cache misses when using pickle cache plugin

This commit is contained in:
dridiha 2026-03-02 21:52:24 +01:00
parent 9b9d8eac09
commit 174dfb4323
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- nmap with pickle as cache plugin - Fixed the cache misses due to the absence of the Plugin Interposer (Issue https://github.com/ansible-collections/community.general/issues/11365)

View file

@ -174,6 +174,16 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
valid = True
return valid
def _is_plugin_interposer(self):
return self._cache._plugin._persistent
def _get_value_from_cache(self, cache_key):
if not self._is_plugin_interposer():
self._cache[cache_key] = self._cache._plugin.get(cache_key)
self._cache._retrieved = self._cache
return self._cache[cache_key]
def parse(self, inventory, loader, path, cache=True):
try:
@ -198,7 +208,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if attempt_to_read_cache:
try:
results = self._cache[cache_key]
results = self._get_value_from_cache(cache_key)
except KeyError:
# This occurs if the cache_key is not in the cache or if the cache_key expired, so the cache needs to be updated
cache_needs_update = True