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,53 +22,39 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
. cdist-config
|
. cdist-config
|
||||||
[ $# -eq 1 ] || __cdist_usage "<object dir>"
|
[ $# -eq 2 ] || __cdist_usage "<object dir> <object>"
|
||||||
set -ue
|
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_out_object_dir="$1"; shift
|
||||||
|
|
||||||
__cdist_object_list "$__cdist_out_object_dir" > "$__cdist_tmp_file"
|
object="$1"; shift
|
||||||
|
|
||||||
# FIXME post 1.0: add dependencies
|
finished="$(__cdist_object_code_finished "$__cdist_object")"
|
||||||
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"
|
|
||||||
|
|
||||||
__cdist_all_code_done=n
|
|
||||||
|
|
||||||
while [ "$__cdist_all_code_done" = n ]; do
|
|
||||||
while read object; do
|
|
||||||
code="$(__cdist_object_code "$object")"
|
code="$(__cdist_object_code "$object")"
|
||||||
require="$(__cdist_object_require "$object")"
|
require="$(__cdist_object_require "$object")"
|
||||||
|
|
||||||
# Object depends on others, execute them before us
|
|
||||||
|
# Do nothing if our work has been done
|
||||||
|
if [ -f "$finished" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Checking code for $object ..."
|
||||||
|
|
||||||
if [ -f "$require" ]; then
|
if [ -f "$require" ]; then
|
||||||
while read requirement; do
|
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"
|
done < "$require"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "Running code for $object ..."
|
|
||||||
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 ..."
|
||||||
"$code"
|
"$code"
|
||||||
|
touch "$__cdist_finished"
|
||||||
else
|
else
|
||||||
__cdist_exit_err "$code exists, but is not executable."
|
__cdist_exit_err "$code exists, but is not executable."
|
||||||
fi
|
fi
|
||||||
|
@ -78,5 +64,3 @@ while [ "$__cdist_all_code_done" = n ]; do
|
||||||
else
|
else
|
||||||
__cdist_exit_err "Missing code for ${object}."
|
__cdist_exit_err "Missing code for ${object}."
|
||||||
fi
|
fi
|
||||||
done < "$__cdist_tmp_file"
|
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in a new issue