mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-08 17:56:33 +00:00
Ignore missing backup file on error (#5910)
When a backup error occurs, it might be that the backup file hasn't been created yet, e.g. when there is no space or no permission on the target backup directory. Deleting the backup file would fail in this case. Use missing_ok instead to ignore a missing backup file on delete.
This commit is contained in:
parent
7593f857e8
commit
bbb8fa0b92
@ -552,12 +552,12 @@ class BackupManager(FileConfiguration, JobGroup):
|
||||
self._change_stage(BackupJobStage.FINISHING_FILE, backup)
|
||||
|
||||
except BackupError as err:
|
||||
await self.sys_run_in_executor(backup.tarfile.unlink)
|
||||
await self.sys_run_in_executor(backup.tarfile.unlink, missing_ok=True)
|
||||
_LOGGER.error("Backup %s error: %s", backup.slug, err)
|
||||
self.sys_jobs.current.capture_error(err)
|
||||
return None
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
await self.sys_run_in_executor(backup.tarfile.unlink)
|
||||
await self.sys_run_in_executor(backup.tarfile.unlink, missing_ok=True)
|
||||
_LOGGER.exception("Backup %s error", backup.slug)
|
||||
await async_capture_exception(err)
|
||||
self.sys_jobs.current.capture_error(
|
||||
|
Loading…
x
Reference in New Issue
Block a user