Provide repository label as a variable in hooks #874

Closed
opened 2024-05-25 18:01:01 +00:00 by sshaikh · 3 comments

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.

### 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.
Owner

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.

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.
Author

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:

BORG: Finished backup of /backup/borg: 33.752306 seconds
466 / 296321 files changed

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.

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: ``` BORG: Finished backup of /backup/borg: 33.752306 seconds 466 / 296321 files changed ``` 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.
Owner

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.

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.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#874
No description provided.