From b46850cd12398ca5cf1392d53e3b9696e559b159 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 Mar 2011 11:39:17 +0100 Subject: [PATCH] begin to reintegrate parameter recording Signed-off-by: Nico Schottelius --- bin/cdist-config | 1 - bin/cdist-type-emulator | 48 +++++++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 531e4384..fbdbe719 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -213,7 +213,6 @@ __cdist_object_list() find . -name "$__cdist_name_object_source" | \ sed -e 's;^./;;' -e "s;/${__cdist_name_object_source}\$;;" ) - } __cdist_object_parameter_dir() diff --git a/bin/cdist-type-emulator b/bin/cdist-type-emulator index 8be6e819..06369895 100755 --- a/bin/cdist-type-emulator +++ b/bin/cdist-type-emulator @@ -62,38 +62,28 @@ fi __cdist_myname="$__cdist_myname ($__cdist_object_id)" ################################################################################ -# Create object in tmpdir +# Create object in tmpdir first # -__cdist_new_object_dir="$__cdist_tmp_dir/$__cdist_object_self" -mkdir -p "${__cdist_new_object_dir}" +# Save original destination +__cdist_out_object_dir_orig="$__cdist_out_object_dir" -# Record source -echo "${__cdist_manifest}" > "${__cdist_new_object_dir}/${__cdist_name_object_source}" +# Store to tmp now +__cdist_out_object_dir="$__cdist_tmp_dir" +__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" +set -x -################################################################################ -# Try to merge object into global object directory -# +# Record source +mkdir -p "${__cdist_object_dir}" +__cdist_object_source_add "${__cdist_object_dir}" -# -__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" -__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" +# Record parameter __cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object")" - -# if [ -e "${__cdist_new_object_dir}" ]; then -# source="$(__cdist_object_source "${__cdist_new_object_dir}")" -# __cdist_exit_err "${__cdist_object} already exists (source: $source)" -# fi - mkdir -p "${__cdist_parameter_dir}" -# Record parameters to tmpdir -tempparameter="${__cdist_tmp_dir}/${__cdist_name_parameter}" -mkdir -p "$tempparameter" - while [ $# -gt 0 ]; do opt="$1"; shift @@ -109,6 +99,14 @@ while [ $# -gt 0 ]; do echo "${value}" > "${tempparameter}/${opt_file}" done +exit 1 + + +################################################################################ +# Try to merge object into global object directory +# + + # Ensure required parameters are given if [ -f "$(__cdist_type_parameter_required "$__cdist_type")" ]; then while read required; do @@ -144,3 +142,11 @@ for requirement in $require; do echo $requirement >> "$(__cdist_object_require "$__cdist_object")" echo Recording: $__cdist_object requires $requirement done + + +# old stuff +# if [ -e "${__cdist_new_object_dir}" ]; then +# source="$(__cdist_object_source "${__cdist_new_object_dir}")" +# __cdist_exit_err "${__cdist_object} already exists (source: $source)" +# fi +