mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 18:07:36 -02:30
fix fact cache receiver
This commit is contained in:
@@ -67,12 +67,12 @@ class FactCacheReceiver(object):
|
|||||||
self.timestamp = datetime.fromtimestamp(date_key, None)
|
self.timestamp = datetime.fromtimestamp(date_key, None)
|
||||||
|
|
||||||
# Update existing Fact entry
|
# Update existing Fact entry
|
||||||
fact_obj = Fact.objects.filter(host__id=host_obj.id, module=module_name, timestamp=self.timestamp)
|
try:
|
||||||
if fact_obj:
|
fact_obj = Fact.objects.get(host__id=host_obj.id, module=module_name, timestamp=self.timestamp)
|
||||||
fact_obj.facts = facts
|
fact_obj.facts = facts
|
||||||
fact_obj.save()
|
fact_obj.save()
|
||||||
logger.info('Updated existing fact <%s>' % (fact_obj.id))
|
logger.info('Updated existing fact <%s>' % (fact_obj.id))
|
||||||
else:
|
except Fact.DoesNotExist:
|
||||||
# Create new Fact entry
|
# Create new Fact entry
|
||||||
fact_obj = Fact.add_fact(host_obj.id, module_name, self.timestamp, facts)
|
fact_obj = Fact.add_fact(host_obj.id, module_name, self.timestamp, facts)
|
||||||
logger.info('Created new fact <fact_id, module> <%s, %s>' % (fact_obj.id, module_name))
|
logger.info('Created new fact <fact_id, module> <%s, %s>' % (fact_obj.id, module_name))
|
||||||
|
|||||||
Reference in New Issue
Block a user