Commit graph

11 commits

Author SHA1 Message Date
Ravi Srinivasa
8abacb694f
test: Add test suite and documentation for custom variable and dictionary support
Tests covering:
- CustomVariable / CustomVariables: rendering, config string generation,
  dictionary and array type behaviour
- CustomVariableDictionaryRendering: Icinga 2 DSL output for nested dicts
- IcingaConfigHelper: macro validation and structured variable rendering
- DirectorProperty: CRUD, inheritance, field assignment
- IcingaHost / IcingaService / IcingaServiceApplyFor: object-level
  custom variable assignment and apply-for rule evaluation
- BasketSnapshotCustomVariable: round-trip basket import/export
- MigrateCommand: migration logic, --delete, --dry-run, skipped fields
- CustomVariableForm / CustomVariablesForm / DeleteCustomVariableForm:
  form submission and validation
- Rendered output fixtures updated for service5/6/7 and new
  host_dynamic_dict, service_apply_for_array, service_apply_for_dict

Documentation:
- Dictionary-Support-Changes.md: full feature overview and API reference
- custom-variables-demo.sh: end-to-end shell demo script
2026-06-01 12:32:15 +02:00
Johannes Meyer
2ca1fc99c9 test: Replace usages of @expectException 2023-08-31 09:48:48 +02:00
Thomas Gelf
b475aa841e IcingaConfigHelper: granular macro-rendering
fixes #685
fixes #1272
fixes #1482
2018-06-04 18:18:32 +02: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
6427b22621 IcingaConfigHelper: fix numeric dictionary key...
...rendering and add related tests

fixes #12591
2016-08-30 12:15:48 +00: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
255acf2fd5 IcingaConfigHelperTest: add duration format tests 2016-02-28 13:25:49 +01:00