You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to reference to the Issue #96 . I wanted to implement the feature, so that Icinga Service template names will be configurable. In my tests I found a problematic behaviour.
The problem here is that the "Default customvars" will be transfered as a dictionary vars = {}, so all other custom vars from the templates will be overwritten.
From the Icinga 2 Docs:
If attributes are of the Dictionary type, you can also use the indexer format. This might be necessary to only override specific custom variables and keep all other existing custom variables (e.g. from templates):
"attrs": { "vars.os": "Linux" }
In the following example I created a Service-Template example1, which sets a new custom variable vars.testcustomvar = "VAR_AUS_TEMPLATE"
Example Service:
As you can see, the template is imported but all configured custom variables are not present, because the custom vars will be transfered as a dictionary. So the custom variables need to be posted on one level, like so:
Hi and happy New Year!
I wanted to reference to the Issue #96 . I wanted to implement the feature, so that Icinga Service template names will be configurable. In my tests I found a problematic behaviour.
The problem here is that the "Default customvars" will be transfered as a dictionary
vars = {}
, so all other custom vars from the templates will be overwritten.From the Icinga 2 Docs:
In the following example I created a Service-Template
example1
, which sets a new custom variablevars.testcustomvar = "VAR_AUS_TEMPLATE"
Example Service:
As you can see, the template is imported but all configured custom variables are not present, because the custom vars will be transfered as a dictionary. So the custom variables need to be posted on one level, like so:
See my PR to fix this Issue.
Best Regards
Philipp
The text was updated successfully, but these errors were encountered: