From 555ffe037d12fe7a6da1f36dab1ce9562bfd4a10 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 10 Jun 2016 11:14:34 -0400 Subject: [PATCH] Requeue jobs if AnsibleHostUnreachable return If ansible-playbook return AnsibleHostUnreachable (3), we can assume there was a network issue runing our playbook. Rather then continuing and potentially posting no logs, we can have zuul requeue the job to try again. Change-Id: I8c4d92fa7156c7d8591ca5b54be8cb30c249eacf Signed-off-by: Paul Belanger --- zuul/launcher/ansiblelaunchserver.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zuul/launcher/ansiblelaunchserver.py b/zuul/launcher/ansiblelaunchserver.py index f644c14b62..82e17171fc 100644 --- a/zuul/launcher/ansiblelaunchserver.py +++ b/zuul/launcher/ansiblelaunchserver.py @@ -785,6 +785,12 @@ class NodeWorker(object): job.sendWorkStatus(0, 100) job_status = self.runAnsiblePlaybook(jobdir, timeout) + if job_status == 3: + # AnsibleHostUnreachable: We had a network issue connecting to + # our zuul-worker. Rather then contiune, have zuul requeue the + # job. + return result + post_status = self.runAnsiblePostPlaybook(jobdir, job_status) if job_status and post_status: status = 'SUCCESS'