Expand available variables in hooks: add location
#867
Labels
No Label
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#867
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
Borgmatic uses Variable Interpolation
for hooks.
At the moment, only 3 variables can be used there (plus envs)
It would be great if there would be more variables possible.
I use borgmatic in combination with my own telegram bot for logging. I backup nfs-mounts there which can sometimes be unavailable.
With the help of the Doku
i managed to deal with it and implement a healthcheck and abort if the nfs mount is not there.
Unfortunately I have to hardcode (or use constants) if I want to log the location that is having the error.
Is it possible to add
{location}
to the possible variables as well ? That could make my configuration a lot more reusable.Implementation Details
Having a first look, I think that is the part of the source code that needs to be expanded. But I don't know if there are other locations as well.
5752373009/borgmatic/commands/borgmatic.py (L288)
Many Thanks in advance.
Have a great Day :)
Expand available variables in hooks:to Expand available variables in hooks: add `location`We can certainly add more interpolated variables if they're generally useful. When you say "location" what exactly are you referring to?
That's it, yeah. Note though that
configuration_filename
is tacked on withinborgmatic/hooks/command.py:execute_hook()
instead.I assume you're using this feature? https://torsion.org/borgmatic/docs/how-to/backup-to-a-removable-drive-or-an-intermittent-server/
I mean location.source_directories (screenshot) :)
Nice, so it's not that hard to add this feature ?
(but with return code 1, cause i need a systemd unit failure and want a error notification)
Thanks for the explanation! However I don't think passing
source_directories
would work here for a couple of reasons:When borgmatic is run with
--verbosity 2
, I believe it should log thefindmnt
command that's erroring, and that includes the mount path. So are you hoping to log, for instance, that/mnt/removable
's NFS mount wasn't available? How are you hoping to log it?