WARNING Variable "{name}" is not supported in the before create everything hook #1213
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 project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
borgmatic-collective/borgmatic#1213
Loadingβ¦
Add table
Add a link
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
When borgmatic runs i see this warning the logs:
WARNING Variable "{name}" is not supported in the before create everything hookThe relevant section of borgmatic's YAML config file contains the following line:
- runuser -l user -c 'dnf --cacheonly repoquery --qf "%{name}\n" --userinstalled > /home/user/Dropbox/userinstalled_$(hostname).txt'{name}in this case is not a borgmatic variable, but a dnf variable in the command being run. However, it's not clear to me how to escape it.This is not an urgent issue, as it is just a warning and the actual behavior is as desired.
Steps to reproduce
No response
Actual behavior
No response
Expected behavior
No response
Other notes / implementation ideas
No response
borgmatic version
2.0.12
borgmatic installation method
Fedora package
Borg version
borg 1.4.3
Python version
Python 3.14.2
Database version (if applicable)
No response
Operating system and version
Fedora 43
Thanks for taking the time to file this. I'll have to think about what if anything can be done about it. Maybe a YAML tag that flags the line as not to be warned about? A borgmatic option to disable the warnings altogether? Something else?
What are your thoughts on these AI suggestions?
I tried {{ }} but that broke the command and still had the warning from borgmatic. Not sure how to test without running borgmatic each time.
I would think finding and documenting how to escape the notation, if possible, makes more sense than changing borgmatic.
The interpolation and warning logic are both performed by borgmatic, so any escape notation would have to be implemented by changing borgmatic.
{{and}}could maybe work, although then it might be a breaking change for anyone who has those literals in their existing commands. That could be okay if documented as such.I don't think
%%would be necessary.Yeah, that's definitely not implemented currently.
You could move/copy the command hook to a borgmatic action other than
create, just temporarily to make testing easier.I have this working now using backslashes for escaping, e.g.
\{name\}. This is consistent with how escaping is already done for environment variable interpolation. And as part of this work, I'm also implementing the same sort of escaping for constant interpolation.I'm working on tests now to finish this up.
Okay, this is implemented in main and will be part of the next release! Docs will be live shortly. Note that this is technically a breaking change, in that anyone who happens to already have
\{name\}in their configuration will see that replaced with{name}. (And no, there's not currently a way to escape the escapes. π )Thanks again for filing this.
Released in borgmatic 2.1.0!
Can confirm: this variable warning is gone with borgmatic 2.1.0 !