begin to reintegrate parameter recording

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
remotes/origin/1.4
Nico Schottelius 14 years ago
parent a6702cc804
commit b46850cd12
  1. 1
      bin/cdist-config
  2. 48
      bin/cdist-type-emulator

@ -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()

@ -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

Loading…
Cancel
Save