Support for more variables #1063

Closed
opened 2025-04-08 17:04:40 +00:00 by aledeg · 5 comments

What I'd like to do and why

In the documentation, there is a mention of variable interpolation.
It's working great!

I was wondering if it could be possible to add the action variable to be able to write something like:

commands:
  - before: action
    run:
      - echo "`date` - starting {action}"

Thank you!

Other notes / implementation ideas

No response

### What I'd like to do and why In the [documentation](https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/#variable-interpolation), there is a mention of _variable interpolation_. It's working great! I was wondering if it could be possible to add the _action_ variable to be able to write something like: ```yaml commands: - before: action run: - echo "`date` - starting {action}" ``` Thank you! ### Other notes / implementation ideas _No response_
Owner

I'm not necessarily averse to the idea, but with your example in particular it seems like built-in logging is the more appropriate solution. So did you have a more involved use in mind for {action} or was it only for an echo like this?

I'm not necessarily averse to the idea, but with your example in particular it seems like built-in logging is the more appropriate solution. So did you have a more involved use in mind for `{action}` or was it only for an `echo` like this?
Owner

I went ahead and included the list of configured action names in any log entries for running command hooks. Example:

testrepo: Running before create/prune action command hook

Just released in borgmatic 2.0.2.

I went ahead and included the list of configured action names in any log entries for running command hooks. Example: ``` testrepo: Running before create/prune action command hook ``` Just released in borgmatic 2.0.2.
Author

In my use case, it was just for echo. But if you have included that in the logs, I'll look into that and let you know.

One might need to use this to trigger external tools based on the action.

Anyway, feel free to close this issue if you think it's covered by other features.

In my use case, it was just for `echo`. But if you have included that in the logs, I'll look into that and let you know. One might need to use this to trigger external tools based on the action. Anyway, feel free to close this issue if you think it's covered by other features.
Owner

Okay, I'll close this for now, but I'd be happy to reopen if the existing logging doesn't meet your needs.

Okay, I'll close this for now, but I'd be happy to reopen if the existing logging doesn't meet your needs.
Author

Excellent!

Excellent!
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#1063