Catch exceptions that might pop up when releasing work units

This commit is contained in:
Bianca Henderson
2021-10-26 16:53:30 -04:00
committed by Shane McDonald
parent a9636426b8
commit d79da1ef9f

View File

@@ -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)