Question: State option on command hooks #1073
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#1073
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?
Hi Dan,
I'm trying to understand the new "states" option on the command hooks that were added in version 2.0.3. Normally I don't have complicated commands and just use commands that I run before and after backups (create step). What exactly would be the difference in the following two hooks?
As I understand it, both are executed in case of an error in the create step, or am I wrong? Are there situations where I should rather use one or the other?
Kind regards,
Marcel
You are correct in identifying this as a documentation gap that needs fixing. The basic difference between the two examples you've included is that one runs sooner than the other. The
after: actionhook runs immediately after the create action fails for a particular repository—so before any subsequent actions for that repository or other repositories even have a chance to run. Whereas theafter: errorhook doesn't run until all repositories in a configuration file have had a chance to execute.Thank you for the explanation. So if you only have one repository in the configuration file, it doesn't really make much difference which of the two variants you use. Did I understand that correctly?
It doesn't make much difference, but there's still a small difference—if you've got subsequent actions after
createfor that one repository,after: actionwithstates: [fail]runs before those actions, whileafter: errorruns after them.Many thanks for the (as always 😄) quick reply and the clarification. The question has been clarified for me and the issue can be closed.
Thanks! I'll leave it open for now just as a reminder to clarify this in the docs.