-
Notifications
You must be signed in to change notification settings - Fork 111
Description
Hi everyone !
Since #1518, rustic gives hooks a bit of context for backups, but I think it would be nice to have that for other commands. My use case is especially monitoring/alerting.
However I feel that too much variables would result in too much specific code and difficulties to document/use.
So I propose the following, available for all hooks :
RUSTIC_COMMAND: command which triggered the hook (prune,snapshots, etc)RUSTIC_HOOK_COMMAND: command of the current hook (as a string)
Additionally, run-failed hooks could benefit from:
RUSTIC_FAILED_COMMAND: command which has failedRUSTIC_FAILED_COMMAND_RC: return code of the failed command
Example use case : ability for the hook to take action depending on the command, e.g. issuing a warning for certain failures, ignoring others, while giving sufficient context so that alerts are meaningful (e.g. a cat failure is not the same as a prune failure).
Maybe each *_COMMAND could be separated in two variables: verb and args.
I feel this is generic enough to serve a lot of use cases.
I know nothing about Rust, but @rdelaage proposed to help if it makes sense.
What do you think ? @aawsome ?