../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,7 +56,7 @@ __cdist_dir push "${__cdist_core_dir}" "${__cdist_remote_core_dir}"
cdist-explorer-run-global "$__cdist_target_host" cdist-explorer-run-global "$__cdist_target_host"
cdist-manifest-run-init "$__cdist_target_host" cdist-manifest-run-init "$__cdist_target_host"
__cdist_object_all cdist-object-prepare __cdist_object_all __cdist_object_prepare
__cdist_object_all __cdist_object_run __cdist_object_all __cdist_object_run
cdist-cache "$__cdist_target_host" cdist-cache "$__cdist_target_host"

View file

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