1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 20:35:55 +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:
Stefan Agner
2025-05-23 14:29:36 +02:00
committed by GitHub
parent 7593f857e8
commit bbb8fa0b92

View File

@@ -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(