summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awx/plugins/isolated/awx_isolated_cleanup.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/awx/plugins/isolated/awx_isolated_cleanup.py b/awx/plugins/isolated/awx_isolated_cleanup.py
index b2f3926bcb..b52939df25 100644
--- a/awx/plugins/isolated/awx_isolated_cleanup.py
+++ b/awx/plugins/isolated/awx_isolated_cleanup.py
@@ -51,9 +51,11 @@ def main():
try:
re_match = re.match(r'\/tmp\/awx_\d+_.+', path)
if re_match is not None:
- if subprocess.check_call(['ansible-runner', 'is-alive', path]) == 0:
- continue
- else:
+ try:
+ if subprocess.check_call(['ansible-runner', 'is-alive', path]) == 0:
+ continue
+ except subprocess.CalledProcessError:
+ # the job isn't running anymore, clean up this path
module.debug('Deleting path {} its job has completed.'.format(path))
except (ValueError, IndexError):
continue