From bbb8fa0b92c8b04444dfd1a91f732e77b4e8bf2c Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 23 May 2025 14:29:36 +0200 Subject: [PATCH] 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. --- supervisor/backups/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervisor/backups/manager.py b/supervisor/backups/manager.py index 2add2c15d..ac95fe5f7 100644 --- a/supervisor/backups/manager.py +++ b/supervisor/backups/manager.py @@ -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(