Elevate warnings to errors or squash errors to warnings #798

Closed
opened 2023-12-03 00:44:55 +00:00 by witten · 2 comments
Owner

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:

BORG_EXIT_CODES=modern

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.

### What I'd like to do and why Borg recently [added support](https://github.com/borgbackup/borg/pull/7928) for [much more granular exit codes](https://github.com/ThomasWaldmann/borg/blob/new-rc-1.2/docs/internals/frontends.rst#message-ids) 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: ``` BORG_EXIT_CODES=modern ``` 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.
Author
Owner
Implemented in main! Docs here: https://torsion.org/borgmatic/docs/how-to/customize-warnings-and-errors/
Author
Owner

Released in borgmatic 1.8.7!

Released in borgmatic 1.8.7!
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#798
No description provided.