Hi

I'm trying to define and use a global function in icinga2 and failing miserable:

in functions.conf:
function test(str) {
        str = str.replace("X", "u")
        return "bla"+str.replace("bla", "blubb")
}

this does reload without error.

In host object:
object Host "gnarf" {
        import "generic-host"
        # more config [...]
        action_url = "bla" + test("XXbrrrm bla")
}

gives me a
critical/config: Error: Invalid field access (for value of type 'Host'): 'test'

while using {{ test("ökjsöldfk") }} compiles, but gives me an url of "Object
of type 'icinga::Function'" which is not what expected.

Would you please point me in the right direction?

BTW: looking at the hangman example didn't help

Cheers,
-- 
Klaus Muth
HAGOS eG                   Industriestr. 62     fon:   (+49) 711 78805-7086
EDV-Programmierung         70565  Stuttgart     fax: (+49) 711 78805-957035
http://www.hagos.de            Germany                 mailto:[email protected]

HAGOS Verbund deutscher Kachelofen- und Luftheizungsbauerbetriebe eG
Sitz:                      Stuttgart
Rechtsform:                Genossenschaft
Registergericht:           Stuttgart GnR 77
Vorstände:                 Guido Eichel, Ralf Tigges
Aufsichtsratsvorsitzender: Thomas Müller
USt.-ID-Nr.:               DE 147799748
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to