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.
This commit is contained in:
Matthew Jones 2015-10-09 12:17:17 -04:00
parent 523a96ebce
commit 4dc56e5d66

View File

@ -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()