Hooks exiting with exit code 1 do not cause backup to fail #214
Labels
No Label
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#214
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
Actual behaviour
I have set up a few before_hooks that run scripts that dump data from docker containers
so that this data can be backed up too.
When an error occurs, the scripts exit with error code 1; borgmatic is happy to continue however, causing me to have an incomplete backup without me noticing, since I only get notified when a backup failed.
I can work around it by using "script.sh || exit 2", but AFAICT the documentation does not mention that exit code 1 is treated as success.
Expected behaviour
I expect borgmatic to either stop the backup when a hook exits with 1, or the fact that only 2+ causes the backup to abort to be documented.
Environment
borgmatic version: 1.3.14
Can I have a look at your hook configuration, and perhaps the output of a
borgmatic --verbosity 2
run when this happens? That'd help me understand what's going on. As far as I know, the borgmatic code does not treat exit code 1 differently from exit code 2 for purposes of interpreting hook errors.It does:
https://projects.torsion.org/witten/borgmatic/src/branch/master/borgmatic/execute.py#L35
So it does! I forgot that hooks now go through that code path.
This is fixed in master. This fix will go out as part of the next release (hopefully soon). Thanks for reporting it!
And now released as part of borgmatic 1.3.15!