add local/remote code run capability

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-19 23:12:49 +01:00
parent 6f79f01206
commit 1785f5acd0

View file

@ -22,30 +22,30 @@
# #
. cdist-config . cdist-config
[ $# -eq 2 ] || __cdist_usage "<object dir> <object>" [ $# -eq 3 ] || __cdist_usage "<object dir> <object> <type>"
set -ue set -ue
# This variable MUST be exactly like this - see __cdist_object_dir # This variable MUST be exactly like this - see __cdist_object_dir
__cdist_out_object_dir="$1"; shift __cdist_out_object_dir="$1"; shift
object="$1"; shift object="$1"; shift
__cdist_gencode_type="$1"; shift
if [ ! -d "$(__cdist_object_dir "$object")" ]; then if [ ! -d "$(__cdist_object_dir "$object")" ]; then
__cdist_exit_err "Object $object is missing." __cdist_exit_err "Object $object is missing."
fi fi
finished="$(__cdist_object_code_finished "$object")" finished="$(__cdist_object_code_finished "$object")"
code="$(__cdist_object_code "$object")"
require="$(__cdist_object_require "$object")" require="$(__cdist_object_require "$object")"
code="$(__cdist_object_code "$object")-${__cdist_gencode_type}"
# Do nothing if our work has been done # Do nothing if our work has been done
if [ -f "$finished" ]; then if [ -f "$finished" ]; then
exit 0 exit 0
fi fi
echo "Checking code for $object ..." echo "Checking code-${__cdist_gencode_type} for $object ..."
if [ -f "$require" ]; then if [ -f "$require" ]; then
while read requirement; do while read requirement; do
@ -57,7 +57,7 @@ fi
if [ -e "$code" ]; then if [ -e "$code" ]; then
if [ -f "$code" ]; then if [ -f "$code" ]; then
if [ -x "$code" ]; then if [ -x "$code" ]; then
echo "Executing code for $object ..." echo "Executing code-${__cdist_gencode_type} for $object ..."
"$code" "$code"
touch "$finished" touch "$finished"
else else