-
Notifications
You must be signed in to change notification settings - Fork 81
Feature/pre command failure #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ILURE if non-zero and abort if ABORT_ON_PRE_COMMANDS_FAILURE if set to "true".
ee29de6 to
51405b1
Compare
|
@djmaze I hope you find some time to review this PR. I am not exactly sure, if this solution is the best one. Also, I wonder if it would make sense, to move the |
|
Handling a Pre Command failure handling sounds like a good feature, we were even not aware that backup is not executed on Pre Command failure, as it was not specified in the docs... |
djmaze
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply. This looks good, thanks! I think we can do it like this.
It needs two additional tests though. Are you willing to do that? Otherwise I can do it later.
Sorry for the late response too, i saw your comment but it was a busy day and i forgot to reply...
So I would be happy if you could add the tests. The branch on my fork is open for maintainer to commit. Thanks! |
I just found, that my backups did not notify me of a failure (
POST_COMMANDS_FAILURE) as thePRE_COMMANDSscript was the one failing. Luckily the part failing was not crucial for the actual data to be backed up but still bad enough.This PR is an attempt, to avoid that issue for the future. It adds
PRE_COMMANDS_FAILUREandABORT_ON_PRE_COMMANDS_FAILURE.PRE_COMMANDS_FAILUREallows to define commands to execute in case of an non-zero exit ofPRE_COMMANDS. To Achieve that, I modified therun_commandshelper, to return a non-zero exit code, when any of the pre commands fails.ABORT_ON_PRE_COMMANDS_FAILUREcan be set to "true" to fail (exit 1) the whole backup when the pre commands failed.I added this to
backupas well aspruneandcheck.I opted against re-using
POST_COMMANDS_FAILURE, to avoid unexpected behaviour for users upgrading.Fixes #91