(bugfix) Mark retention failures as backup warnings

Add a warning status for BackupRun records so successful snapshots are not
reported as failed when post-run SQL retention fails.

Keep the prune error in the run result, link the successful snapshot, and
let the management command complete with a warning instead of raising a
backup failure.

Include warning runs in backup trend summaries and add a regression test
for successful backups with failed retention cleanup.
This commit is contained in:
2026-05-19 23:20:52 +02:00
parent 1e04da9de8
commit 8bff241b12
6 changed files with 49 additions and 15 deletions

View File

@@ -111,7 +111,7 @@ def execute_backup_run(
)
except Exception as exc:
result["prune"] = {"ok": False, "error": str(exc), "type": type(exc).__name__}
run.status = BackupRun.Status.FAILED
run.status = BackupRun.Status.WARNING
run.result = result
run.snapshot = snapshot_record
run.save(
@@ -125,7 +125,6 @@ def execute_backup_run(
"result",
],
)
raise
run.snapshot = snapshot_record
run.result = result