before_everything errors notifications #821
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#821
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Hello, devs.
What is the logic/problem behind not firing the
on_errorhook or Apprise (or other)fail:notification in case of errors inbefore_everythinghook?I'd like to make some preparations (like dumping LUKS headers, backing up my local services running in containers, etc.) only once, and then do the actual backup into multiple repositories (local + offsite). Seems like the
before_everything(and the cleanup inafter_everything) is what I need. What is a proper way to be notified about errors on those steps?Should I rely on the scheduling app (systemd timer in my case) to get the notifications? Wouldn't it be more convenient to have all notifications settings in one place (in the borgmatic itself)?
Thanks for filing this!
There's no fundamental reason that
on_errorcouldn't trigger whenbefore_everythingerrors. The main reason it doesn't happen now is incidental: Theon_errorhook currently triggers on a per-configuration basis, andbefore_everythinghappens before the main processing for each configuration file. But it could in theory be altered to triggeron_error.As for Apprise hook's
fail:notification getting triggered, it's the same reason:before_everythinghappens well before all that Apprise logic kicks in. That could also be changed.As a work-around until this is implemented, yes, you could relying on systemd to notify you of errors.
So rather than make the
before_everything/after_everythinghooks trigger theon_errorhook (and Apprise), I ended up adding a new hook type that triggers an error hook (and Apprise) as necessary. This required refactoring the way that hooks work, both under the hood and at the configuration file level. Documentation is here: https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/The new hook type is a
configurationhook, and it runs at the scope of a whole configuration file... in other words, before and after all actions and repositories in that configuration file. Hopefully that works for your use case.This is implemented in main and will be available in the next release.
Released in borgmatic 2.0.0!