Skip to content

Commit bbb8fa0

Browse files
authored
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.
1 parent 7593f85 commit bbb8fa0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

supervisor/backups/manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,12 @@ async def _do_backup(
552552
self._change_stage(BackupJobStage.FINISHING_FILE, backup)
553553

554554
except BackupError as err:
555-
await self.sys_run_in_executor(backup.tarfile.unlink)
555+
await self.sys_run_in_executor(backup.tarfile.unlink, missing_ok=True)
556556
_LOGGER.error("Backup %s error: %s", backup.slug, err)
557557
self.sys_jobs.current.capture_error(err)
558558
return None
559559
except Exception as err: # pylint: disable=broad-except
560-
await self.sys_run_in_executor(backup.tarfile.unlink)
560+
await self.sys_run_in_executor(backup.tarfile.unlink, missing_ok=True)
561561
_LOGGER.exception("Backup %s error", backup.slug)
562562
await async_capture_exception(err)
563563
self.sys_jobs.current.capture_error(

0 commit comments

Comments
 (0)