From dc4b014d125730c77434f5bda8e8cc3849a2f58f Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Tue, 31 Aug 2021 12:02:39 -0400 Subject: [PATCH] Make status command in error handling cleaner (#10823) --- awx/main/tasks.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 6169ed2a90..32a953e968 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -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)