forked from ungleich-public/cdist
refactor cdist-remote-code-run-all
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
209e34512d
commit
42af407d3e
2 changed files with 13 additions and 14 deletions
|
@ -42,6 +42,7 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
|||
|
||||
: ${__cdist_name_bin:=bin}
|
||||
: ${__cdist_name_code:=code}
|
||||
: ${__cdist_name_code_finished:=.codedone}
|
||||
: ${__cdist_name_conf_dir:=conf}
|
||||
: ${__cdist_name_explorer:=explorer}
|
||||
: ${__cdist_name_gencode:=gencode}
|
||||
|
@ -239,6 +240,11 @@ __cdist_object_code()
|
|||
echo "$(__cdist_object_dir "$1")/${__cdist_name_code}"
|
||||
}
|
||||
|
||||
__cdist_object_code_finished()
|
||||
{
|
||||
echo "$(__cdist_object_dir "$1")/${__cdist_name_code_finished}"
|
||||
}
|
||||
|
||||
__cdist_object_parameter_dir()
|
||||
{
|
||||
echo "$(__cdist_object_dir "$1")/${__cdist_name_parameter}"
|
||||
|
|
|
@ -30,21 +30,14 @@ __cdist_out_object_dir="$1"; shift
|
|||
|
||||
__cdist_object_list "$__cdist_out_object_dir" > "$__cdist_tmp_file"
|
||||
|
||||
# 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}."
|
||||
require="$(__cdist_object_require "$object")"
|
||||
|
||||
# Object code depends on others, execute them before us
|
||||
if [ -f "$require" ]; then
|
||||
while read requirement; do
|
||||
cdist-remote-code-run "$code"
|
||||
done < "$require"
|
||||
fi
|
||||
done < "$__cdist_tmp_file"
|
||||
|
|
Loading…
Reference in a new issue