Closed wolneykien closed 4 months ago
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Paul Wolneykien. This is most likely caused by a git client misconfiguration; please make sure to:
git config --list | grep email
git config --global user.email email@example.com
Didn't test, but I could imagine that it also works like this:
var user = this
use(user)
Didn't test, but I could imagine that it also works like this:
* At the beginning of the template get the user: `var user = this` * Capture that var in the filter closure: `use(user)`
Wow, thanks. It seems to work. I'll re-test today on a "vanilla" icinga2
instance.
The closure approach works well. And this is the project where the mentioned ApiUser
template is used: https://github.com/wolneykien/icinga2-usersyncd .
The current evaluation context of the
filter
function defined for anApiUser
doesn't provide any way to access the user object itself.With the patch applied the problem of having an
ApiUser
perHost
(see https://community.icinga.com/t/per-host-api-user-for-passive-check-submission/9053/3 , for instance) can be solved by first defining a template like this:And then by creating an
ApiUser
that imports it, possibly using the REST API. I. e.: