re-integrate cdist-object-codegen-all

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-25 01:06:02 +01:00
parent e4377f7532
commit ea39e137f3
3 changed files with 13 additions and 10 deletions

View file

@ -193,6 +193,11 @@ __cdist_remote_object_dir()
echo "${__cdist_remote_out_object_base_dir}/$1"
}
__cdist_object_code()
{
echo "$(__cdist_object_dir "$1")/${__cdist_name_code}"
}
__cdist_object_parameter_dir()
{
echo "$(__cdist_object_dir "$1")/${__cdist_name_parameter}"

View file

@ -55,9 +55,11 @@ cdist-manifest-run-all "$__cdist_target_host" "$__cdist_out_object_dir"
# Run explorer of each type for every object of types with explorer
cdist-object-explorer-all "$__cdist_target_host" "$__cdist_out_object_dir"
exit 2
# Generate code for all objects
cdist-object-codegen-all "$__cdist_target_host" "$__cdist_out_object_dir" \
"$__cdist_out_code_dir"
cdist-object-codegen-all "$__cdist_target_host" "$__cdist_out_object_dir" "$__cdist_out_execs"
exit 2
cdist-exec-transfer "$__cdist_target_host" "$__cdist_out_execs"
cdist-exec-run "$__cdist_target_host"

View file

@ -25,26 +25,22 @@
. cdist-config
if [ $# -ne 3 ]; then
__cdist_usage "<target host> <object_base_dir> <outdir>"
__cdist_usage "<target host> <object_base_dir>"
fi
set -eu
__cdist_target_host="$1"; shift
__cdist_object_base_dir="$1"; shift
__cdist_exec_dir="$1"; shift
__cdist_object_list "$__cdist_object_base_dir" > "$__cdist_tmp_file"
while read object; do
outdir="$__cdist_exec_dir/${object}"
outfile="${outdir}/${__cdist_name_exec}"
mkdir -p "${outdir}"
code="$(__cdist_object_code "$object")"
cdist-object-codegen "$__cdist_target_host" \
"$__cdist_object_base_dir" \
"$object" > "${outfile}"
"$object" > "${code}"
chmod u+x "${outfile}"
chmod u+x "${code}"
done < "$__cdist_tmp_file"