forked from ungleich-public/cdist
Add env vars usage idiom for writing types
This commit is contained in:
parent
2f20b31758
commit
58b0e83655
1 changed files with 13 additions and 0 deletions
|
@ -331,6 +331,19 @@ So when you generate a script with the following content, it will work:
|
|||
fi
|
||||
|
||||
|
||||
Environment variable usage idiom
|
||||
--------------------------------
|
||||
In type scripts you can support environment variables with default values if
|
||||
environment variable is unset or null by using **${parameter:-[word]}**
|
||||
parameter expansion.
|
||||
|
||||
Example using mktemp in a portable way that supports TMPDIR environment variable.
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
tempfile=$(mktemp "${TMPDIR:-/tmp}/cdist.XXXXXXXXXX")
|
||||
|
||||
|
||||
Log level in types
|
||||
------------------
|
||||
cdist log level can be accessed from __cdist_log_level variable.One of:
|
||||
|
|
Loading…
Reference in a new issue