Skip to content

Commit

Permalink
Save tracebacks from receptor module to callback object
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Mar 4, 2022
1 parent c601bd2 commit 56d3033
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions awx/main/tasks/receptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,21 +369,18 @@ def _run_internal(self, receptor_ctl):
if state_name == 'Succeeded':
return res

if not self.task.instance.result_traceback:
try:
resultsock = receptor_ctl.get_work_results(self.unit_id, return_sockfile=True)
lines = resultsock.readlines()
receptor_output = b"".join(lines).decode()
if receptor_output:
self.task.instance.result_traceback = receptor_output
self.task.instance.save(update_fields=['result_traceback'])
elif detail:
self.task.instance.result_traceback = detail
self.task.instance.save(update_fields=['result_traceback'])
else:
logger.warn(f'No result details or output from {self.task.instance.log_format}, status:\n{state_name}')
except Exception:
raise RuntimeError(detail)
try:
resultsock = receptor_ctl.get_work_results(self.unit_id, return_sockfile=True)
lines = resultsock.readlines()
receptor_output = b"".join(lines).decode()
if receptor_output:
self.task.runner_callback.delay_update(result_traceback=receptor_output)
elif detail:
self.task.runner_callback.delay_update(result_traceback=detail)
else:
logger.warn(f'No result details or output from {self.task.instance.log_format}, status:\n{state_name}')
except Exception:
raise RuntimeError(detail)

return res

Expand Down

0 comments on commit 56d3033

Please sign in to comment.