1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Delete collection tarball when no longer needed

* Delete after shipping it
   * Delete when ship() fails
This commit is contained in:
Christian Adams 2019-06-27 16:46:54 -04:00
parent 4470e9ca26
commit e72b2fac6d

View File

@ -119,6 +119,7 @@ def ship(path):
""" """
Ship gathered metrics via the Insights agent Ship gathered metrics via the Insights agent
""" """
try:
agent = 'insights-client' agent = 'insights-client'
if shutil.which(agent) is None: if shutil.which(agent) is None:
logger.error('could not find {} on PATH'.format(agent)) logger.error('could not find {} on PATH'.format(agent))
@ -140,3 +141,6 @@ def ship(path):
logger.exception('{} failure:'.format(cmd)) logger.exception('{} failure:'.format(cmd))
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
logger.exception('{} timeout:'.format(cmd)) logger.exception('{} timeout:'.format(cmd))
finally:
# cleanup tar.gz
os.remove(path)