[Common] Catch tarfile exception if no filepaths exist
This commit is contained in:
parent
eeccc47dde
commit
15741047ed
|
@ -173,10 +173,14 @@ def archive_files(arc_name, filepaths):
|
|||
# TODO: Remove oldest timestamped archives.
|
||||
log.warning('More than %s tarballs in config archive', max_num_arcs)
|
||||
|
||||
try:
|
||||
with tarfile.open(arc_filepath, 'w:' + arc_comp) as tf:
|
||||
for filepath in filepaths:
|
||||
tf.add(filepath, arcname=os.path.basename(filepath))
|
||||
|
||||
except OSError:
|
||||
log.error('Problem occurred archiving filepaths: %s', filepaths)
|
||||
return False
|
||||
else:
|
||||
return arc_filepath
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue