forked from ungleich-public/cdist
document new feature: configurable default values for parameters
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
fc40a40ae0
commit
9358efd273
2 changed files with 15 additions and 1 deletions
|
@ -116,6 +116,11 @@ confdir/type/<name>/parameter/required::
|
||||||
confdir/type/<name>/parameter/optional::
|
confdir/type/<name>/parameter/optional::
|
||||||
Parameters optionally accepted by type, \n seperated list.
|
Parameters optionally accepted by type, \n seperated list.
|
||||||
|
|
||||||
|
confdir/type/<name>/parameter/default/*::
|
||||||
|
Default values for optional parameters.
|
||||||
|
Assuming an optional parameter name of 'foo', it's default value would
|
||||||
|
be read from the file confdir/type/<name>/parameter/default/foo.
|
||||||
|
|
||||||
confdir/type/<name>/parameter/boolean::
|
confdir/type/<name>/parameter/boolean::
|
||||||
Boolean parameters accepted by type, \n seperated list.
|
Boolean parameters accepted by type, \n seperated list.
|
||||||
|
|
||||||
|
|
|
@ -82,10 +82,16 @@ follow the standard unix behaviour "the last given wins".
|
||||||
If either is missing, the type will have no required, no optional, no boolean
|
If either is missing, the type will have no required, no optional, no boolean
|
||||||
or no parameters at all.
|
or no parameters at all.
|
||||||
|
|
||||||
|
Default values for optional parameters can be predefined in
|
||||||
|
***parameter/default/<name>***.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
echo servername >> cdist/conf/type/__nginx_vhost/parameter/required
|
echo servername >> cdist/conf/type/__nginx_vhost/parameter/required
|
||||||
echo logdirectory >> cdist/conf/type/__nginx_vhost/parameter/optional
|
echo logdirectory >> cdist/conf/type/__nginx_vhost/parameter/optional
|
||||||
|
echo loglevel >> cdist/conf/type/__nginx_vhost/parameter/optional
|
||||||
|
mkdir cdist/conf/type/__nginx_vhost/parameter/default
|
||||||
|
echo warning > cdist/conf/type/__nginx_vhost/parameter/default/loglevel
|
||||||
echo server_alias >> cdist/conf/type/__nginx_vhost/parameter/optional_multiple
|
echo server_alias >> cdist/conf/type/__nginx_vhost/parameter/optional_multiple
|
||||||
echo use_ssl >> cdist/conf/type/__nginx_vhost/parameter/boolean
|
echo use_ssl >> cdist/conf/type/__nginx_vhost/parameter/boolean
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -108,6 +114,9 @@ if [ -f "$__object/parameter/logdirectory" ]; then
|
||||||
logdirectory="$(cat "$__object/parameter/logdirectory")"
|
logdirectory="$(cat "$__object/parameter/logdirectory")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# optional parameter with predefined default
|
||||||
|
loglevel="$(cat "$__object/parameter/loglevel")"
|
||||||
|
|
||||||
# boolean parameter
|
# boolean parameter
|
||||||
if [ -f "$__object/parameter/use_ssl" ]; then
|
if [ -f "$__object/parameter/use_ssl" ]; then
|
||||||
# file exists -> True
|
# file exists -> True
|
||||||
|
|
Loading…
Reference in a new issue