From 0e2c221b43d9c3bf8c56880d2a194f602289f53d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Jun 2011 01:07:56 +0200 Subject: [PATCH] ../bin/cdist-object-prepare -> __cdist_object_prepare Signed-off-by: Nico Schottelius --- bin/cdist-deploy-to | 4 +-- .../__cdist_object_prepare | 36 ++++++++++--------- 2 files changed, 21 insertions(+), 19 deletions(-) rename bin/cdist-object-prepare => core/__cdist_object_prepare (50%) diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 3711fac5..9d5573f3 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -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" diff --git a/bin/cdist-object-prepare b/core/__cdist_object_prepare similarity index 50% rename from bin/cdist-object-prepare rename to core/__cdist_object_prepare index d21d8a63..edb38e12 100755 --- a/bin/cdist-object-prepare +++ b/core/__cdist_object_prepare @@ -24,24 +24,26 @@ # - run type manifest # -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu +__cdist_object_prepare() +{ + [ $# -eq 1 ] || __cdist_usage "" + 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 +}