fix a bug which can cause isolated artifact cleanup to fail

see: https://github.com/ansible/awx/issues/4376
This commit is contained in:
Ryan Petrello 2019-07-25 15:44:13 -04:00
parent 24b166aec9
commit 2608e8d47d
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

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