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
|
. 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")"
|
||||||
code="$(__cdist_object_code "$object")"
|
require="$(__cdist_object_require "$object")"
|
||||||
echo "Running code for $object ..."
|
|
||||||
if [ -e "$code" ]; then
|
|
||||||
if [ -f "$code" ]; then
|
# Do nothing if our work has been done
|
||||||
if [ -x "$code" ]; then
|
if [ -f "$finished" ]; then
|
||||||
"$code"
|
exit 0
|
||||||
else
|
fi
|
||||||
__cdist_exit_err "$code exists, but is not executable."
|
|
||||||
fi
|
echo "Checking code for $object ..."
|
||||||
|
|
||||||
|
if [ -f "$require" ]; then
|
||||||
|
while read requirement; do
|
||||||
|
echo "Running dependency $requirement for $object ..."
|
||||||
|
cdist-remote-code-run "$__cdist_out_object_dir" "$object"
|
||||||
|
done < "$require"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$code" ]; then
|
||||||
|
if [ -f "$code" ]; then
|
||||||
|
if [ -x "$code" ]; then
|
||||||
|
echo "Executing code for $object ..."
|
||||||
|
"$code"
|
||||||
|
touch "$__cdist_finished"
|
||||||
else
|
else
|
||||||
__cdist_exit_err "$code exists, but is not a file."
|
__cdist_exit_err "$code exists, but is not executable."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
__cdist_exit_err "Missing code for ${object}."
|
__cdist_exit_err "$code exists, but is not a file."
|
||||||
fi
|
fi
|
||||||
done < "$__cdist_tmp_file"
|
else
|
||||||
|
__cdist_exit_err "Missing code for ${object}."
|
||||||
__cdist_all_code_done=n
|
fi
|
||||||
|
|
||||||
while [ "$__cdist_all_code_done" = n ]; do
|
|
||||||
while read object; do
|
|
||||||
code="$(__cdist_object_code "$object")"
|
|
||||||
require="$(__cdist_object_require "$object")"
|
|
||||||
|
|
||||||
# Object depends on others, execute them before us
|
|
||||||
if [ -f "$require" ]; then
|
|
||||||
while read requirement; do
|
|
||||||
cdist-remote-code-run "$code"
|
|
||||||
done < "$require"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
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"
|
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in a new issue