mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 13:27:40 -02:30
Fix fact gathering module being absent
Somewhere recently we broke the ability to gather multiple modules in one scan job pass. This fixes that, it also further improves the scan job performance.
This commit is contained in:
@@ -50,7 +50,7 @@ class CacheModule(BaseCacheModule):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
# Basic in-memory caching for typical runs
|
# Basic in-memory caching for typical runs
|
||||||
self._cache = {}
|
self._cache = {}
|
||||||
self._cache_prev = {}
|
self._all_keys = {}
|
||||||
|
|
||||||
# This is the local tower zmq connection
|
# This is the local tower zmq connection
|
||||||
self._tower_connection = C.CACHE_PLUGIN_CONNECTION
|
self._tower_connection = C.CACHE_PLUGIN_CONNECTION
|
||||||
@@ -72,12 +72,10 @@ class CacheModule(BaseCacheModule):
|
|||||||
def identify_new_module(self, key, value):
|
def identify_new_module(self, key, value):
|
||||||
# Return the first key found that doesn't exist in the
|
# Return the first key found that doesn't exist in the
|
||||||
# previous set of facts
|
# previous set of facts
|
||||||
if key in self._cache_prev:
|
if key in self._all_keys:
|
||||||
value_old = self._cache_prev[key]
|
for k in value.iterkeys():
|
||||||
for k,v in value.iteritems():
|
if k not in self._all_keys[key] and not k.startswith('ansible_'):
|
||||||
if k not in value_old:
|
return k
|
||||||
if not k.startswith('ansible_'):
|
|
||||||
return k
|
|
||||||
# First time we have seen facts from this host
|
# First time we have seen facts from this host
|
||||||
# it's either ansible facts or a module facts (including module_setup)
|
# it's either ansible facts or a module facts (including module_setup)
|
||||||
elif len(value) == 1:
|
elif len(value) == 1:
|
||||||
@@ -110,7 +108,7 @@ class CacheModule(BaseCacheModule):
|
|||||||
# Assume ansible fact triggered the set if no new module found
|
# Assume ansible fact triggered the set if no new module found
|
||||||
facts = self.filter_ansible_facts(value) if not module else dict({ module : value[module]})
|
facts = self.filter_ansible_facts(value) if not module else dict({ module : value[module]})
|
||||||
self._cache[key] = value
|
self._cache[key] = value
|
||||||
self._cache_prev = copy(self._cache)
|
self._all_keys[key] = value.keys()
|
||||||
packet = {
|
packet = {
|
||||||
'host': key,
|
'host': key,
|
||||||
'inventory_id': os.environ['INVENTORY_ID'],
|
'inventory_id': os.environ['INVENTORY_ID'],
|
||||||
|
|||||||
Reference in New Issue
Block a user