forked from ungleich-public/cdist
in theory finish new cdist-remote-code-run
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
20715e4afa
commit
209e34512d
1 changed files with 33 additions and 49 deletions
|
@ -22,61 +22,45 @@
|
|||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 1 ] || __cdist_usage "<object dir>"
|
||||
[ $# -eq 2 ] || __cdist_usage "<object dir> <object>"
|
||||
set -ue
|
||||
|
||||
# Warning: Variable is special, as interpreted by __cdist_object_dir()
|
||||
# This variable MUST be exactly like this - see __cdist_object_dir
|
||||
__cdist_out_object_dir="$1"; shift
|
||||
|
||||
__cdist_object_list "$__cdist_out_object_dir" > "$__cdist_tmp_file"
|
||||
object="$1"; shift
|
||||
|
||||
# FIXME post 1.0: add dependencies
|
||||
while read object; do
|
||||
code="$(__cdist_object_code "$object")"
|
||||
echo "Running code for $object ..."
|
||||
if [ -e "$code" ]; then
|
||||
if [ -f "$code" ]; then
|
||||
if [ -x "$code" ]; then
|
||||
"$code"
|
||||
else
|
||||
__cdist_exit_err "$code exists, but is not executable."
|
||||
fi
|
||||
else
|
||||
__cdist_exit_err "$code exists, but is not a file."
|
||||
fi
|
||||
else
|
||||
__cdist_exit_err "Missing code for ${object}."
|
||||
fi
|
||||
done < "$__cdist_tmp_file"
|
||||
finished="$(__cdist_object_code_finished "$__cdist_object")"
|
||||
code="$(__cdist_object_code "$object")"
|
||||
require="$(__cdist_object_require "$object")"
|
||||
|
||||
__cdist_all_code_done=n
|
||||
|
||||
while [ "$__cdist_all_code_done" = n ]; do
|
||||
while read object; do
|
||||
code="$(__cdist_object_code "$object")"
|
||||
require="$(__cdist_object_require "$object")"
|
||||
# Do nothing if our work has been done
|
||||
if [ -f "$finished" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Object depends on others, execute them before us
|
||||
if [ -f "$require" ]; then
|
||||
echo "Checking code for $object ..."
|
||||
|
||||
if [ -f "$require" ]; then
|
||||
while read requirement; do
|
||||
cdist-remote-code-run "$code"
|
||||
echo "Running dependency $requirement for $object ..."
|
||||
cdist-remote-code-run "$__cdist_out_object_dir" "$object"
|
||||
done < "$require"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo "Running code for $object ..."
|
||||
if [ -e "$code" ]; then
|
||||
if [ -e "$code" ]; then
|
||||
if [ -f "$code" ]; then
|
||||
if [ -x "$code" ]; then
|
||||
echo "Executing code for $object ..."
|
||||
"$code"
|
||||
touch "$__cdist_finished"
|
||||
else
|
||||
__cdist_exit_err "$code exists, but is not executable."
|
||||
fi
|
||||
else
|
||||
__cdist_exit_err "$code exists, but is not a file."
|
||||
fi
|
||||
else
|
||||
else
|
||||
__cdist_exit_err "Missing code for ${object}."
|
||||
fi
|
||||
done < "$__cdist_tmp_file"
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue