documentation to __object in execution run

This commit is contained in:
Daniel Heule 2014-03-20 16:23:28 +01:00
parent 5ef27191fc
commit b87b5eab31
2 changed files with 29 additions and 6 deletions

View file

@ -157,13 +157,13 @@ TYPES
The following types are available:
eof
for type in man7/cdist-type__*.text; do
set -x
for type in man7/cdist-type__*.html; do
no_dir="${type#man7/}";
no_type="${no_dir#cdist-type}";
name="${no_type%.text}";
name="${no_type%.html}";
name_no_underline="$(echo $name | sed 's/^__/\\__/g')"
man="${no_dir%.text}(7)"
man="${no_dir%.html}(7)"
echo "- $name_no_underline" "($man)"
done
@ -209,10 +209,12 @@ __messages_out::
Available for: initial manifest, type manifest, type gencode
__object::
Directory that contains the current object.
Available for: type manifest, type explorer, type gencode
Available for: type manifest, type explorer, type gencode and
at the execution of the gencode scripts
__object_id::
The type unique object id.
Available for: type manifest, type explorer, type gencode
Available for: type manifest, type explorer, type gencode and
at the execution of the gencode scripts
Note: The leading and the trailing "/" will always be stripped (caused by
the filesystem database and ensured by the core).
Note: Double slashes ("//") will not be fixed and result in an error.

View file

@ -252,6 +252,27 @@ echo "touch /etc/cdist-configured"
--------------------------------------------------------------------------------
VARIABLE ACCESS FROM THE GENERATED SCRIPTS
------------------------------------------
In the generated scripts, you have access to the following cdist variables
- __object
- __object_id
but only for read operations, means there is no back copy of this
files after the script execution.
So when you generate a script with the following content, it will work:
--------------------------------------------------------------------------------
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
--------------------------------------------------------------------------------
HINTS FOR TYPEWRITERS
----------------------
It must be assumed that the target is pretty dumb and thus does not have high