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 <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-06-10 11:14:34 -04:00
parent b114e6741d
commit 555ffe037d
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 6 additions and 0 deletions

View File

@ -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'