mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 02:17:37 -02:30
Move error handling into try/catch block
This commit is contained in:
@@ -3113,9 +3113,14 @@ class AWXReceptorJob:
|
|||||||
resultsock.shutdown(socket.SHUT_RDWR)
|
resultsock.shutdown(socket.SHUT_RDWR)
|
||||||
resultfile.close()
|
resultfile.close()
|
||||||
elif res.status == 'error':
|
elif res.status == 'error':
|
||||||
unit_status = receptor_ctl.simple_command(f'work status {self.unit_id}')
|
try:
|
||||||
detail = unit_status['Detail']
|
unit_status = receptor_ctl.simple_command(f'work status {self.unit_id}')
|
||||||
state_name = unit_status['StateName']
|
detail = unit_status.get('Detail', None)
|
||||||
|
state_name = unit_status.get('StateName', None)
|
||||||
|
except RuntimeError as e:
|
||||||
|
detail = ''
|
||||||
|
state_name = ''
|
||||||
|
logger.warn(e)
|
||||||
|
|
||||||
if 'exceeded quota' in detail:
|
if 'exceeded quota' in detail:
|
||||||
logger.warn(detail)
|
logger.warn(detail)
|
||||||
|
|||||||
Reference in New Issue
Block a user