Make status command in error handling cleaner (#10823)

This commit is contained in:
Alan Rominger 2021-08-31 12:02:39 -04:00 committed by GitHub
parent d129928e42
commit dc4b014d12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3071,10 +3071,9 @@ class AWXReceptorJob:
resultsock.shutdown(socket.SHUT_RDWR)
resultfile.close()
elif res.status == 'error':
# TODO: There should be a more efficient way of getting this information
receptor_work_list = receptor_ctl.simple_command("work list")
detail = receptor_work_list[self.unit_id]['Detail']
state_name = receptor_work_list[self.unit_id]['StateName']
unit_status = receptor_ctl.simple_command(f'work status {self.unit_id}')
detail = unit_status['Detail']
state_name = unit_status['StateName']
if 'exceeded quota' in detail:
logger.warn(detail)