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:
parent
9a8c5c4f3f
commit
d6d9144a0e
|
@ -1620,6 +1620,20 @@ class AnsibleJob(object):
|
||||||
job_output.write("{now} | {line}\n".format(
|
job_output.write("{now} | {line}\n".format(
|
||||||
now=datetime.datetime.now(),
|
now=datetime.datetime.now(),
|
||||||
line=line.decode('utf-8').rstrip()))
|
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)
|
return (self.RESULT_NORMAL, ret)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue