From d79da1ef9fc19dd85cf5a3795f46c2cc1da056d6 Mon Sep 17 00:00:00 2001 From: Bianca Henderson Date: Tue, 26 Oct 2021 16:53:30 -0400 Subject: [PATCH] Catch exceptions that might pop up when releasing work units --- awx/main/tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 90b5672241..9ea2447126 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -3071,7 +3071,10 @@ class AWXReceptorJob: finally: # Make sure to always release the work unit if we established it if self.unit_id is not None and settings.RECEPTOR_RELEASE_WORK: - receptor_ctl.simple_command(f"work release {self.unit_id}") + try: + receptor_ctl.simple_command(f"work release {self.unit_id}") + except Exception as e: + logger.exception(e) @property def sign_work(self): @@ -3128,7 +3131,7 @@ class AWXReceptorJob: 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: + except Exception as e: detail = '' state_name = '' logger.exception(e)