Fix error with rejoining node to cluster after lost connection to postgres

This commit is contained in:
Buymov Ivan
2019-07-04 17:31:15 +03:00
committed by Ryan Petrello
parent bc6edf7af3
commit f2676064fd

View File

@@ -33,7 +33,11 @@ def reap(instance=None, status='failed', excluded_uuids=[]):
'''
Reap all jobs in waiting|running for this instance.
'''
me = instance or Instance.objects.me()
me = instance
if me is None:
(changed, me) = Instance.objects.get_or_register()
if changed:
logger.info("Registered tower node '{}'".format(me.hostname))
now = tz_now()
workflow_ctype_id = ContentType.objects.get_for_model(WorkflowJob).id
jobs = UnifiedJob.objects.filter(