../bin/cdist-object-prepare -> __cdist_object_prepare

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-06-14 01:07:56 +02:00
parent cc7da0c264
commit 0e2c221b43
2 changed files with 21 additions and 19 deletions

View file

@ -56,8 +56,8 @@ __cdist_dir push "${__cdist_core_dir}" "${__cdist_remote_core_dir}"
cdist-explorer-run-global "$__cdist_target_host"
cdist-manifest-run-init "$__cdist_target_host"
__cdist_object_all cdist-object-prepare
__cdist_object_all __cdist_object_run
__cdist_object_all __cdist_object_prepare
__cdist_object_all __cdist_object_run
cdist-cache "$__cdist_target_host"
__cdist_echo info "cdist $__cdist_version: Successfully finished run"

View file

@ -24,24 +24,26 @@
# - run type manifest
#
. cdist-config
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
set -eu
__cdist_object_prepare()
{
[ $# -eq 1 ] || __cdist_usage "<object>"
set -eu
__cdist_target_host="$1"; shift
__cdist_object_self="$1"; shift
__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
[ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined"
__cdist_target_host="$1"; shift
__cdist_object_self="$1"; shift
__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
[ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined"
# Export to non-core for use in manifest and gencode scripts
export $__cdist_name_var_self=$__cdist_object_self
# Export to non-core for use in manifest and gencode scripts
export $__cdist_name_var_self=$__cdist_object_self
__cdist_object_prepared="$(__cdist_object_prepared "$__cdist_object_self")"
if [ ! -f "$__cdist_object_prepared" ]; then
__cdist_echo info "Preparing object"
cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object_self"
cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object_self"
__cdist_object_prepared="$(__cdist_object_prepared "$__cdist_object_self")"
if [ ! -f "$__cdist_object_prepared" ]; then
__cdist_echo info "Preparing object"
cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object_self"
cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object_self"
# Mark this object as prepared
touch "$__cdist_object_prepared"
fi
# Mark this object as prepared
touch "$__cdist_object_prepared"
fi
}