From d6d9144a0e262721009a15d3b7f5655ee202622f Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 14 Sep 2017 10:00:22 -0600 Subject: [PATCH] Add a message to the job log on unexpected exceptions We only get messages in the debug log on unexpected exceptions. Add a message to the job log so that people can know there was a problem. Change-Id: I4cb6c5d22724b55c265577dffa581a3c8e74ec25 --- zuul/executor/server.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zuul/executor/server.py b/zuul/executor/server.py index 62b97161bd..0e56656cc6 100644 --- a/zuul/executor/server.py +++ b/zuul/executor/server.py @@ -1620,6 +1620,20 @@ class AnsibleJob(object): job_output.write("{now} | {line}\n".format( now=datetime.datetime.now(), line=line.decode('utf-8').rstrip())) + elif ret == 250: + # Unexpected error from ansible + with open(self.jobdir.job_output_file, 'a') as job_output: + job_output.write("{now} | UNEXPECTED ANSIBLE ERROR\n".format( + now=datetime.datetime.now())) + found_marker = False + for line in syntax_buffer: + if line.startswith('ERROR! Unexpected Exception'): + found_marker = True + if not found_marker: + continue + job_output.write("{now} | {line}\n".format( + now=datetime.datetime.now(), + line=line.decode('utf-8').rstrip())) return (self.RESULT_NORMAL, ret)