Config::Augeas::Validator - A generic configuration validator API
use Config::Augeas::Validator; # Initialize my $validator = Config::Augeas::Validator->new(rulesdir => $rulesdir); $validator->play(@files); exit $validator->{err};
$rulesdir points to one or more directories of rules, separated by colons.
The Config::Augeas::Validator configuration files are INI files.
The DEFAULT section is mandatory. It contains the following variables:
The name of the lens to use, for example:
lens=Httpd
The exit code to return when a test fails. This parameter is optional. Example:
err_code=3
Each section apart from the DEFAULT section defines a rule, as listed in the rules variable of the DEFAULT section. Each rule contains several parameters.
The rule description, for example:
name=Application Type
The explanation for the rule, for example:
explanation=Check that application type is FOO or BAR
The type of rule. For now, Config::Augeas::Validator only supports the count type, which returns the count nodes matching expr. Example:
type=count
The Augeas expression for the rule. The $file variable is the path to the file in the Augeas tree. Example:
$file
expr=$file/VirtualHost[#comment =~ regexp("^1# +((AI|BO)\+?|DR)$")]
The value expected for the test. For example, if using the count type, the number of matches expected for the expression. Example:
value=1
The importance level of the test. Possible values are 'error' (default) and 'warning'. When set to 'error', a failed test will interrupt the processing and set the return code. When set to 'warning', a failed test will display a warning, continue, and have no effect on the return code. When set to 'ignore', the test is ignored and never run.
level=warning
Config::Augeas
/etc/augeas-validator/rules.d The default rules directory for Config::Augeas::Validator.
To install Config::Augeas::Validator, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Augeas::Validator
CPAN shell
perl -MCPAN -e shell install Config::Augeas::Validator
For more information on module installation, please visit the detailed CPAN module installation guide.