Variable '{hostname}' is not supported in after error hook #1075
Reference in New Issue
Block a user
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 want borgmatic to email me if something went wrong. This error has been there for ages...
Steps to reproduce
My config file has:
Actual behavior
Running "borgmatic create" and then killing borg+ssh I get:
Expected behavior
There should be no " Variable '{hostname}' is not supported in after error hook" error to console.
...or some other way to email me error+output?
Other notes / implementation ideas
No response
borgmatic version
2.0.3
borgmatic installation method
No response
Borg version
1.2.7
Python version
3.9.21
Database version (if applicable)
No response
Operating system and version
Foobar Linux 9 (Centos stream 9)
Thanks for filing this. I am able to repro this behavior, although I'm not yet sure exactly what's going on. I can tell you that
Variable '{hostname}' is not supported in after error hookis a warning, and shouldn't impact anything downstream. To answer your question, there isn't yet a built-in borgmatic hook for sending email directly, but there are a number of monitoring hooks, some of which can send email as a side effect. And of course there's always the option to add a command hook to send email manually as you're doing here.This is fixed in main and will be part of the next release! The solution I went with was to suppress this warning when a variable matches a Borg placeholder (with the idea that Borg will handle the variable) but still show the warning otherwise for an unknown variable.
Released in borgmatic 2.0.4!