From: Gunnar Beutner Date: Tue, 5 Feb 2013 14:31:29 +0000 (+0100) Subject: Update documentation: Types, #include <> X-Git-Tag: v0.0.2~552 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63db2bb89ac8ff07bfefd61e717fda506e7d8de5;p=icinga2 Update documentation: Types, #include <> Fixes #3624 --- diff --git a/docs/icinga2-config.txt b/docs/icinga2-config.txt index a0124d2b6..0c3d044cb 100644 --- a/docs/icinga2-config.txt +++ b/docs/icinga2-config.txt @@ -314,7 +314,18 @@ Example: #include "conf.d/*.conf" ------------------------------------------------------------------------------- -NOTE: Wildcard includes are not currently implemented. +Icinga also supports include search paths similar to how they work in a +C/C++ compiler: + +------------------------------------------------------------------------------- +#include +------------------------------------------------------------------------------- + +Note the use of angle brackets instead of double quotes. This causes the +config compiler to search the include search paths for the specified file. +By default $PREFIX/icinga2 is included in the list of search paths. + +Wildcards are not permitted when using angle brackets. Library directive ~~~~~~~~~~~~~~~~~ @@ -330,6 +341,50 @@ Example: NOTE: The "icinga" library is automatically loaded by Icinga. +Type Definition +~~~~~~~~~~~~~~~ + +By default Icinga has no way of semantically verifying its configuration +objects. This is where type definitions come in. Using type definitions you +can specify which attributes are allowed in an object definition. + +Example: + +------------------------------------------------------------------------------- +type Pizza { + number radius, + + dictionary ingredients { + string *, + + dictionary * { + number quantity, + string name + } + }, + + any custom::* +} +------------------------------------------------------------------------------- + +The Pizza definition provides the following validation rules: + +* Pizza objects may contain an attribute "radius" which has to be a number. +* Pizza objects may contain an attribute "ingredients" which has to be a +dictionary. +* Elements in the ingredients dictionary can be either a string or a dictionary. +* If they're a dictionary they may contain attributes "quantity" (of type +number) and "name" (of type string). +* Pizza objects may contain attribute matching the pattern "custom::*" of any +type. + +Valid types for type rules include: +* any +* number +* string +* scalar (an alias for string) +* dictionary + Configuration Objects ---------------------