Handle unifying the datetime value as a key that we can update on the

tower side
This commit is contained in:
Matthew Jones
2015-02-20 17:19:19 -05:00
parent fd1668dfd8
commit 70f2e5ea1d
2 changed files with 13 additions and 5 deletions

View File

@@ -30,6 +30,7 @@
# POSSIBILITY OF SUCH DAMAGE.
import sys
import datetime
from ansible import constants as C
from ansible.cache.base import BaseCacheModule
@@ -45,6 +46,7 @@ class CacheModule(BaseCacheModule):
# This is the local tower zmq connection
self._tower_connection = C.CACHE_PLUGIN_CONNECTION
self.date_key = datetime.datetime.utcnow()
try:
self.context = zmq.Context()
self.socket = self.context.socket(zmq.REQ)
@@ -57,7 +59,7 @@ class CacheModule(BaseCacheModule):
return {} # Temporary until we have some tower retrieval endpoints
def set(self, key, value):
self.socket.send_json(dict(host=key, facts=value))
self.socket.send_json(dict(host=key, facts=value, date_key=self.date_key))
self.socket.recv()
def keys(self):