1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix: a test alert button; damage shown and warned of on restore

Audit of the alerts and backup verification: an operator could learn
that the alert mail or webhook works only from a real failure. Settings
> Alerts gets "Send a test alert", sent at once to the channels saved,
each channel's result shown. A damaged backup's reasons were only in a
tooltip, so not on a touch screen: they show under the badge. A restore
of a backup that a verification found damaged, or of an incremental on
a damaged base (shown as Ready), said nothing: the restore pages warn.
This commit is contained in:
catborise 2026-11-19 17:14:03 +03:00
parent dcd7e32df7
commit 2c8493ba8c
15 changed files with 254 additions and 70 deletions

View file

@ -136,6 +136,14 @@ class Backup(models.Model):
deleted like a failed one."""
return self.state == self.CREATING and self.operation_id is not None and self.operation.state in Operation.ACTIVE
def damaged_in_chain(self):
"""It, or the first backup it builds on, that a verification found damaged; None."""
backup, seen = self, set()
while backup is not None and not backup.damage and backup.pk not in seen: # a broken chain may loop
seen.add(backup.pk)
backup = backup.parent
return backup if backup is not None and backup.damage else None
def depended_on(self):
"""Whether a backup builds on this one: a failed one holds nothing."""
return self.children.filter(state__in=self.LIVING).exists()