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
This commit is contained in:
Monty Taylor 2017-09-14 10:00:22 -06:00
parent 9a8c5c4f3f
commit d6d9144a0e
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 14 additions and 0 deletions

View File

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