Fail more gracefully if analytics.ship() is called with a bad path,

or it's deleted out from under us.
This commit is contained in:
Bill Nottingham 2020-07-24 14:01:48 -04:00
parent 1a15f18be3
commit 9f67b6742c

View File

@ -191,6 +191,9 @@ def ship(path):
if not path:
logger.error('Automation Analytics TAR not found')
return
if not os.path.exists(path):
logger.error('Automation Analytics TAR {} not found'.format(path))
return
if "Error:" in str(path):
return
try:
@ -223,4 +226,5 @@ def ship(path):
response.text))
finally:
# cleanup tar.gz
os.remove(path)
if os.path.exists(path):
os.remove(path)