From f2676064fd357ff0eccfbb7dd5fc44de5474d056 Mon Sep 17 00:00:00 2001 From: Buymov Ivan Date: Thu, 4 Jul 2019 17:31:15 +0300 Subject: [PATCH] Fix error with rejoining node to cluster after lost connection to postgres --- awx/main/dispatch/reaper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/main/dispatch/reaper.py b/awx/main/dispatch/reaper.py index 39991b6501..2c45507c2c 100644 --- a/awx/main/dispatch/reaper.py +++ b/awx/main/dispatch/reaper.py @@ -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(