-
Notifications
You must be signed in to change notification settings - Fork 716
Delete Backup files on error #5880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We consider failures during Home Assistatn Core and folder backup as fatal errors. In this case, we don't return a reference to the backup file (if run in forground), hence the backup is really considered fatal. Let's delete the backup files in this case. Also add unit tests for the backup manager to verify this behavior.
📝 WalkthroughWalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant JobScheduler
participant BackupManager
participant Backup
User->>JobScheduler: Schedule full backup job
JobScheduler->>BackupManager: Call _do_backup(...)
BackupManager->>Backup: Start backup (store_* methods)
alt Backup succeeds
BackupManager->>JobScheduler: Return Backup
else Backup fails (BackupError or Exception)
BackupManager->>Backup: Delete tarfile (unlink)
BackupManager->>JobScheduler: Return None, record error
end
sequenceDiagram
participant Test
participant JobScheduler
participant BackupManager
participant Backup
Test->>JobScheduler: Schedule backup job (simulate error)
JobScheduler->>BackupManager: Call _do_backup(...)
BackupManager->>Backup: store_* method raises error
BackupManager->>Backup: Delete tarfile (unlink)
BackupManager->>JobScheduler: Return None, record error
JobScheduler->>Test: Test asserts error details and file deletion
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🔇 Additional comments (8)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support pa 8000 ge for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 👍
../Frenck
Proposed change
We consider failures during Home Assistatn Core and folder backup as fatal errors. In this case, we don't return a reference to the backup file (if run in forground), hence the backup is really considered fatal. Let's delete the backup files in this case.
Also add unit tests for the backup manager to verify this behavior.
Type of change
Additional information
Checklist
ruff format supervisor tests
)If API endpoints or add-on configuration are added/changed:
Summary by CodeRabbit
Bug Fixes
Tests