Commit Graph

25 Commits

Author SHA1 Message Date
Thomas Gelf a6928a8bc1 CustomVariable: render expressions in Arrays...
...and introduce a new abstract method
2016-11-14 10:17:52 +01:00
Thomas Gelf ee0def7d2b Lots of files: make IDE users happy 2016-11-01 18:28:36 +01:00
Thomas Gelf 9ba6116091 IcingaService: support and test speciall object...
...name variants with apply for
2016-10-22 06:54:53 +00:00
Thomas Gelf b7eaab715b Make explicit calls to renderStringWithVariables 2016-10-22 05:48:09 +00:00
Corentin Ardeois 37c91050c7 Expressions syntax is now $var$
Instead of $$var$$.
We make sure $$var$$ is left untouched.

refs #11976
2016-10-22 00:15:09 +00:00
Corentin Ardeois ddcfb09f58 Handle expressions only for apply objects
Expressions will be handled only if the object is an ApplyRule.
Only properties and custom variables are replaced.

refs #11976
2016-10-22 00:15:09 +00:00
Corentin Ardeois bcef87f4c9 Add support for expressions
Any rendered string can contain variables encapsulated with "$$" characters.

Example:
Display Name declared with `Port $$host.vars.tcp_port$$ check` will
be processed as `"Port " + host.vars.tcp_port + " check"`

API:
```bash
 ./director-curl POST director/service?name=my_service '{"display_name": "Port $$host.vars.tcp_port$$ check" }'
 ```

 Rendered config:
 ```
  apply Service "my_service" {
      import "my_template"

      display_name = "Port " + host.vars.tcp_port + " check"
  }
 ```

refs #11976
2016-10-22 00:15:09 +00:00
Thomas Gelf 4cd399e059 IcingaConfigHelper: use string-based sort for...
...dictionary fields to make PHP 5.x and PHP 7.x produce the same output.

refs #12591
2016-09-07 20:44:03 +00:00
Thomas Gelf 6427b22621 IcingaConfigHelper: fix numeric dictionary key...
...rendering and add related tests

fixes #12591
2016-08-30 12:15:48 +00:00
Thomas Gelf 9750d4f637 IcingaConfigHelper: do not quote safe keys
Why? It looks better. Sex sells, you know. And Rune asked for it.
Additionally, we now write empty dictionaries on a single line

fixes #12447
2016-08-25 20:44:43 +00:00
Thomas Gelf 601e182b15 IcingaConfigHelper: extend reserved words list 2016-08-25 11:26:14 +00:00
Thomas Gelf fdfedbae04 IcingaConfigHelper: render dictionaries sorted
Adjusted test scenario
2016-03-08 09:24:18 +01:00
Thomas Gelf c25c7ee95b IcingaConfigHelper: allow to render key/op/value 2016-02-29 17:36:12 +01:00
Thomas Gelf 11e5ef0362 IcingaConfigHelper: empty intervals are null 2016-02-28 16:27:06 +01:00
Thomas Gelf 4dde0eaaf6 IcingaConfigHelper: Icinga2 doesn't support 2m 30s 2016-02-28 13:55:16 +01:00
Thomas Gelf a5013cd052 IcingaConfigHelper: output should fit defined tests 2016-02-28 13:26:32 +01:00
Thomas Gelf 3ee9841bc7 IcingaConfigHelper: provide helpers for intervals 2016-02-28 12:40:11 +01:00
Thomas Gelf 9f36a3184f IcingaConfigHelper: add renderExpression 2015-12-02 02:47:49 +01:00
Thomas Gelf 5f9fb8eb83 IcingaConfigHelper: add missing exception class 2015-11-13 23:52:51 +01:00
Thomas Gelf 249b849b08 IcingaConfigHelper: introduce alreadyRendered() 2015-10-16 18:36:43 +02:00
Alexander Fuhr e9e9f91fee IcingaConfigHelper: Use config renderer and escape strings 2015-06-16 17:54:38 +02:00
Thomas Gelf fbc56df500 CustomVariableDictionary: rudimentary rendering 2015-06-15 14:51:06 +02:00
Thomas Gelf 212a36a858 CustomVariableArray: move renderArray to config helper 2015-06-15 14:32:35 +02:00
Thomas Gelf f354d3c034 IcingaConfig: improve prefix/intendation handling 2015-06-11 23:02:43 +02:00
Thomas Gelf 6475e0495a IcingaConfigHelper: move to IcingaConfig namespace 2015-06-11 22:44:17 +02:00