Merge pull request #6301 from gamuniz/catch_analytics_failure

rework the gather() to always delete the leftover directories

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-03-16 20:45:36 +00:00 committed by GitHub
commit e210ee4077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,13 +134,17 @@ def gather(dest=None, module=None, collection_type='scheduled'):
settings.SYSTEM_UUID,
run_now.strftime('%Y-%m-%d-%H%M%S%z')
])
tgz = shutil.make_archive(
os.path.join(os.path.dirname(dest), tarname),
'gztar',
dest
)
shutil.rmtree(dest)
return tgz
try:
tgz = shutil.make_archive(
os.path.join(os.path.dirname(dest), tarname),
'gztar',
dest
)
return tgz
except Exception:
logger.exception("Failed to write analytics archive file")
finally:
shutil.rmtree(dest)
def ship(path):