From 4dc56e5d66ef088d49d9fb994e220cc7a26b13cd Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Fri, 9 Oct 2015 12:17:17 -0400 Subject: [PATCH] Fix an issue with ansible 2.0 and our fact cacher This will be dependent on a PR submitted to core for 2.0 also: https://github.com/ansible/ansible/pull/12695 So will not work right away unless you are pulling from devel. --- awx/plugins/fact_caching/tower.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/awx/plugins/fact_caching/tower.py b/awx/plugins/fact_caching/tower.py index e4b6c19920..ce965f9b11 100755 --- a/awx/plugins/fact_caching/tower.py +++ b/awx/plugins/fact_caching/tower.py @@ -49,7 +49,6 @@ except ImportError: class CacheModule(BaseCacheModule): def __init__(self, *args, **kwargs): - # Basic in-memory caching for typical runs self._cache = {} self._cache_prev = {} @@ -111,16 +110,15 @@ class CacheModule(BaseCacheModule): module = self.identify_new_module(key, value) # 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]}) - - self._cache_prev = deepcopy(self._cache) self._cache[key] = value - + self._cache_prev = deepcopy(self._cache) packet = { 'host': key, 'inventory_id': os.environ['INVENTORY_ID'], 'facts': facts, 'date_key': self.date_key, } + # Emit fact data to tower for processing self.socket.send_json(packet) self.socket.recv()