Merge pull request #5351 from ansible/exec_node_error_handling

[4.1] Improve Error Handling for When Job Cannot Be Delivered to an Execution Node
This commit is contained in:
Bianca Henderson
2021-10-15 13:29:27 -04:00
committed by GitHub

View File

@@ -3117,9 +3117,14 @@ class AWXReceptorJob:
resultsock.shutdown(socket.SHUT_RDWR)
resultfile.close()
elif res.status == 'error':
unit_status = receptor_ctl.simple_command(f'work status {self.unit_id}')
detail = unit_status['Detail']
state_name = unit_status['StateName']
try:
unit_status = receptor_ctl.simple_command(f'work status {self.unit_id}')
detail = unit_status.get('Detail', None)
state_name = unit_status.get('StateName', None)
except RuntimeError as e:
detail = ''
state_name = ''
logger.exception(e)
if 'exceeded quota' in detail:
logger.warn(detail)