def _restore_from_backup(self, version):
logger.debug('Restoring from backup for {}'.format(version))
for file_path in self.files_to_preserve:
try:
shutil.copy2(os.path.join(self.backup_target, file_path),
os.path.join(self.tmp_dir, file_path))
except IOError as e:
logger.warning('Copying {} failed due to {}'
.format(file_path, e))
shutil.unpack_archive(self._backup_name_ext(
version), self.backup_target, self.backup_format)
for file_path in self.files_to_preserve:
try:
shutil.copy2(os.path.join(self.tmp_dir, file_path),
os.path.join(self.backup_target, file_path))
except IOError as e:
logger.warning('Copying {} failed due to {}'
.format(file_path, e))
shutil.rmtree(self.tmp_dir, ignore_errors=True)
评论列表
文章目录