Sometimes it happens, that user create dictionaries which ared use to create services, which contains leading or trailing white(spaces).
Unfortunately I overlook such warnings (sometimes)
apply Service "servicename-" for ( desc => config in host.vars.servicedict ) { .... display_name = "servicename: " + desc.trim() }
I can trim() display_name and notes but not the service
The applied services are running perfect.
Has someone a idea, whether it’s possible to prevent such a warning.
this is my actual solution:
I must use a helper function, wich use trim() to clean the dictionary keys and returns a rebuilded perfect dictionary to to apply …
globals.trimDictionaryKeys = function(dict) {
var result = {}
for (key => value in dict) {
result[key.trim()] = value
}
return result
}
apply Service "servicename-" for ( desc => config in trimDictionaryKeys(host.vars.servicedict) ) { .... display_name = "servicename: " + desc.trim() }