mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 18:07:36 -02:30
Make workflow_job.assert_successful() give specifics
This commit is contained in:
@@ -13,11 +13,37 @@ class WorkflowJob(UnifiedJob):
|
||||
result = self.related.relaunch.post(payload)
|
||||
return self.walk(result.url)
|
||||
|
||||
def failure_output_details(self):
|
||||
"""Special implementation of this part of assert_status so that
|
||||
workflow_job.assert_successful() will give a breakdown of failure
|
||||
"""
|
||||
msg = '\nNode summary:'
|
||||
node_list = self.related.workflow_nodes.get().results
|
||||
|
||||
for node in node_list:
|
||||
msg += '\n{}:'.format(node.id)
|
||||
if node.job:
|
||||
msg += ' {}'.format(node.summary_fields.job)
|
||||
else:
|
||||
msg += ' None'
|
||||
for rel in ('failure_nodes', 'always_nodes', 'success_nodes'):
|
||||
val = getattr(node, rel, [])
|
||||
if val:
|
||||
msg += ' {} {}'.format(rel, val)
|
||||
|
||||
msg += '\n\nUnhandled individual job failures:\n'
|
||||
for node in node_list:
|
||||
if node.job and not (node.failure_nodes or node.always_nodes):
|
||||
job = node.related.job.get()
|
||||
try:
|
||||
job.assert_successful()
|
||||
except Exception as e:
|
||||
msg += str(e)
|
||||
return msg
|
||||
|
||||
@property
|
||||
def result_stdout(self):
|
||||
# workflow jobs do not have result_stdout
|
||||
# which is problematic for the UnifiedJob.is_successful reliance on
|
||||
# related stdout endpoint.
|
||||
if 'result_stdout' not in self.json:
|
||||
return 'Unprovided AWX field.'
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user