diff --git a/awx/main/management/commands/run_fact_cache_receiver.py b/awx/main/management/commands/run_fact_cache_receiver.py index d36b1fc792..2e3159ba44 100644 --- a/awx/main/management/commands/run_fact_cache_receiver.py +++ b/awx/main/management/commands/run_fact_cache_receiver.py @@ -9,7 +9,7 @@ from datetime import datetime # Django from django.core.management.base import NoArgsCommand from django.conf import settings -#from django.core.exceptions import Does +from django.utils import timezone # AWX from awx.main.models.fact import Fact @@ -64,7 +64,7 @@ class FactCacheReceiver(object): return None (module_name, facts) = self.process_facts(facts_data) - self.timestamp = datetime.fromtimestamp(date_key, None) + self.timestamp = datetime.fromtimestamp(date_key, timezone.utc) # Update existing Fact entry try: diff --git a/awx/plugins/fact_caching/tower.py b/awx/plugins/fact_caching/tower.py index ce965f9b11..84b44a5e6f 100755 --- a/awx/plugins/fact_caching/tower.py +++ b/awx/plugins/fact_caching/tower.py @@ -32,7 +32,6 @@ import sys import os import time -import datetime from copy import deepcopy from ansible import constants as C try: @@ -55,7 +54,7 @@ class CacheModule(BaseCacheModule): # This is the local tower zmq connection self._tower_connection = C.CACHE_PLUGIN_CONNECTION - self.date_key = time.mktime(datetime.datetime.utcnow().timetuple()) + self.date_key = time.time() try: self.context = zmq.Context() self.socket = self.context.socket(zmq.REQ)