Elevate warnings to errors or squash errors to warnings #798
Loading…
x
Reference in New Issue
Block a user
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'd like to do and why
Borg recently added support for much more granular exit codes than just "success" (0), "warning" (1), and "error" (2). It would be great if borgmatic could take advantage of these exit codes as part of this ticket. Specifically, borgmatic users often want specific Borg errors/warnings (like permissions issues, file not found) to be either elevated to errors or squashed a warning, even if that's not how Borg treats them. So maybe there could be a borgmatic configuration options to accomplish that for specific Borg errors/warnings.
There are likely existing borgmatic tickets this may address.
Other notes / implementation ideas
The way to enable this feature in supported versions of Borg (beginning in 1.4.0alpha1) is to pass the following environment variable:
So borgmatic could always set that variable and, if the version of Borg installed supports it, then it'll return the new more granular exit codes. Otherwise it'll only return 0, 1, and 2 and any features implemented as part of this ticket won't work.
Implemented in main!
Docs here: https://torsion.org/borgmatic/docs/how-to/customize-warnings-and-errors/
Released in borgmatic 1.8.7!
With today's release of Borg 1.4, you can now use this borgmatic feature with a stable release of Borg!