Provide repository label as a variable in hooks #874
Loading…
x
Reference in New Issue
Block a user
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?
What I'd like to do and why
I'd like to have access to the label associated with a repository on running of hooks. This is both for aesthetic reasons, but also to call nested borgmatic commands.
Other notes / implementation ideas
Provide {label} in hooks.
Good idea! This has been implemented in main and will be part of the next release. (EDIT: Calling this "repository_label" instead of "label" for clarity.)
However, I'm interested in what nested borgmatic commands you're calling and why...? Generally I don't recommend calling borgmatic from borgmatic due to infinite recursion risks.
I produce some statistics of the backup just made including the number of changed files, repo size, added chunks etc. Most of this goes into a Prometheus scrape target, but I also send a summary:
I'll definitely change the repo name to label, but the only way I know how to get the other stats is with borg list, info and diff... and borgmatic lets me do that trivially via the config file (I'm currently hard coding the repo -> label mapping in anticipation of this feature).
I did think of the danger of recursion, but figured it's an advanced use anyway.
Got it.. Thanks for explaining. You may be interested in #617 which is a similar use case. I'll close this ticket for now since the main ask is implemented.
Released in borgmatic 1.8.12!