--repository Filter is not applied to commands #1176
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#1176
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?
What I'm trying to do and why
I've recently migrated to borgmatic 2.x, and therefore reformated the hook scripts.
I'm using a hook to inform me of a successfull backup via the following hook:
This should obviously only run, when a backup for a given repository was finished (and did in 1.x with
after_backup, see https://margau.net/posts/2024-08-02-borgmatic-prometheus/Now, when I run a filtered borgmatic action with default actions (failure on repo1 is intended), the "create finish action" runs for the other two repos in the config file too:
It seems that the
--repository-filter is only applied to the actual actions, but not the hooks.If I understood the docs correctly, I'd expect that the commands for repo2 and repo3 would never run for the filter
--repository repo1.If this is the case, it is probably dangerous, because it could create a "backup was successfull"-command when no backup was actually tried for this repo.
Steps to reproduce
In the config files,
repo1,repo2andrepo3are configured.Also, an "after create finish"-action is configured (see above)
Actual behavior
Commands are also being executed for repo2 and repo3
Expected behavior
No commands run for repo2 and repo3
Other notes / implementation ideas
No response
borgmatic version
2.0.10
borgmatic installation method
pipx
Borg version
borg 1.2.4
Python version
Python 3.11.2
Database version (if applicable)
No response
Operating system and version
Debian GNU/Linux 12 (bookworm)
Thanks for taking the time to file this and provide all the details. I haven't had a chance to dig into this yet, but I have managed to reproduce the behavior you're seeing, and I agree that it seems pretty non-intuitive!
Okay, this is fixed in main and will be part of the next release. Thanks again for bringing this to my attention!
Just released in borgmatic 2.0.11!