mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
[Common] Catch tarfile exception if no filepaths exist
This commit is contained in:
parent
eeccc47dde
commit
15741047ed
1 changed files with 9 additions and 5 deletions
|
@ -173,11 +173,15 @@ def archive_files(arc_name, filepaths):
|
||||||
# TODO: Remove oldest timestamped archives.
|
# TODO: Remove oldest timestamped archives.
|
||||||
log.warning('More than %s tarballs in config archive', max_num_arcs)
|
log.warning('More than %s tarballs in config archive', max_num_arcs)
|
||||||
|
|
||||||
with tarfile.open(arc_filepath, 'w:' + arc_comp) as tf:
|
try:
|
||||||
for filepath in filepaths:
|
with tarfile.open(arc_filepath, 'w:' + arc_comp) as tf:
|
||||||
tf.add(filepath, arcname=os.path.basename(filepath))
|
for filepath in filepaths:
|
||||||
|
tf.add(filepath, arcname=os.path.basename(filepath))
|
||||||
return arc_filepath
|
except OSError:
|
||||||
|
log.error('Problem occurred archiving filepaths: %s', filepaths)
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return arc_filepath
|
||||||
|
|
||||||
|
|
||||||
def windows_check():
|
def windows_check():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue