Constant not accepted by borgmatic validate in shell commands to be executed before/after create/prune/compact/check #741
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#741
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?
What I'm trying to do and why
I want to use "constant" to define a (long) command to be executed before/after create/prune/compact/check (and avoid copy-pasting it multiple times). Specifically, it is a command to notify the user that a backup is in progress (since I want to use borgmatic in a cronjob).
For instance, I defined a constant like this in the
~/.config/borgmatic/config.yaml
file:And I want to use it like this (again in the
~/.config/borgmatic/config.yaml
file):However, the command
borgmatic config validate --config ~/.config/borgmatic/config.yaml
returns an error telling me that there is an issue with the line- {notify} "Starting a backup."
:Note: I tried with a more simple command (c.f. below) but the issue remains.
Steps to reproduce
Output:
~/.config/borgmatic/config.yaml
with the following:Output:
Actual behavior
borgmatic config validate
does not accept "constant" being used in shell commands to be executed before/after create/prune/compact/check in borgmatic config file.Expected behavior
"constant" can be used in shell commands to be executed before/after create/prune/compact/check in borgmatic config file.
Other notes / implementation ideas
No response
borgmatic version
1.8.0
borgmatic installation method
extra/borgmatic 1.8.0-1 ArchLinux package
Borg version
1.2.4
Python version
3.11.3
Database version (if applicable)
No response
Operating system and version
ArchLinux
I believe this is actually a YAML limitation. The
{
at the start of thebefore_backup
value is confusing the YAML parser because that's how you start an inline mapping value (key/value pairs all on one line). So to specify a constant at the start of a value without confusing YAML is to quote it. For instance:Note that the inner quotes are single quotes in that example. Let me know if that works for you!
What I can do though is clarify this limitation in the documentation.