mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #655 from kay0u/patch-4
[enh] Ensure the tar file is closed during the backup
This commit is contained in:
commit
7e37833347
2 changed files with 4 additions and 3 deletions
|
@ -75,7 +75,7 @@
|
|||
"backup_archive_name_unknown": "Unknown local backup archive named '{name:s}'",
|
||||
"backup_archive_open_failed": "Unable to open the backup archive",
|
||||
"backup_archive_system_part_not_available": "System part '{part:s}' not available in this backup",
|
||||
"backup_archive_writing_error": "Unable to add files to backup into the compressed archive",
|
||||
"backup_archive_writing_error": "Unable to add files '{source:s}' (named in the archive: '{dest:s}') to backup into the compressed archive '{archive:s}'",
|
||||
"backup_ask_for_copying_if_needed": "Some files couldn't be prepared to be backuped using the method that avoid to temporarily waste space on the system. To perform the backup, {size:s}MB should be used temporarily. Do you agree?",
|
||||
"backup_borg_not_implemented": "Borg backup method is not yet implemented",
|
||||
"backup_cant_mount_uncompress_archive": "Unable to mount in readonly mode the uncompress archive directory",
|
||||
|
|
|
@ -1802,10 +1802,11 @@ class TarBackupMethod(BackupMethod):
|
|||
# Add the "source" into the archive and transform the path into
|
||||
# "dest"
|
||||
tar.add(path['source'], arcname=path['dest'])
|
||||
tar.close()
|
||||
except IOError:
|
||||
logger.error(m18n.n('backup_archive_writing_error'), exc_info=1)
|
||||
logger.error(m18n.n('backup_archive_writing_error', source=path['source'], archive=self._archive_file, dest=path['dest']), exc_info=1)
|
||||
raise YunohostError('backup_creation_failed')
|
||||
finally:
|
||||
tar.close()
|
||||
|
||||
# Move info file
|
||||
shutil.copy(os.path.join(self.work_dir, 'info.json'),
|
||||
|
|
Loading…
Add table
Reference in a new issue