Documentation: How to use @ to escape keywords

fixes #7028
This commit is contained in:
Michael Friedrich 2014-09-15 17:28:38 +02:00
parent 41f0b9864b
commit 2f751f2ed3
1 changed files with 31 additions and 1 deletions

View File

@ -50,6 +50,36 @@ used as constants or custom attributes.
zone
in
You can escape reserved keywords using the `@` character. The following example
will try to set `vars.include` which references a reserved keyword and generates
the following error:
[2014-09-15 17:24:00 +0200] critical/config: Location:
/etc/icinga2/conf.d/hosts/localhost.conf(13): vars.sla = "24x7"
/etc/icinga2/conf.d/hosts/localhost.conf(14):
/etc/icinga2/conf.d/hosts/localhost.conf(15): vars.include = "some cmdb export field"
^^^^^^^
/etc/icinga2/conf.d/hosts/localhost.conf(16): }
/etc/icinga2/conf.d/hosts/localhost.conf(17):
Config error: in /etc/icinga2/conf.d/hosts/localhost.conf: 15:8-15:14: syntax error, unexpected include (T_INCLUDE), expecting T_IDENTIFIER
[2014-09-15 17:24:00 +0200] critical/config: 1 errors, 0 warnings.
You can escape the `include` key with an additiona `@` character becoming `vars.@include`:
object Host "localhost" {
import "generic-host"
address = "127.0.0.1"
address6 = "::1"
vars.os = "Linux"
vars.sla = "24x7"
vars.@include = "some cmdb export field"
}
## <a id="configuration-syntax"></a> Configuration Syntax