From cf88f9cacb51a89748d556994c441882978bd276 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Jun 2011 00:28:08 +0200 Subject: [PATCH] finished migration of cdist-dir to __cdist_dir Signed-off-by: Nico Schottelius --- bin/cdist-config | 4 +++- bin/cdist-deploy-to | 7 ++++++- core/__cdist_dir | 30 ++++++++++++++---------------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 13d2c0a4..942b4ea7 100644 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -44,6 +44,7 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" : ${__cdist_name_cache:=cache} : ${__cdist_name_code:=code} : ${__cdist_name_conf_dir:=conf} +: ${__cdist_name_core_dir:=core} : ${__cdist_name_dot_cdist:=.cdist} : ${__cdist_name_explorer:=explorer} : ${__cdist_name_gencode:=gencode} @@ -111,7 +112,7 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX") : ${__cdist_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache} : ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"} -: ${__cdist_core_dir:="$(cd "$__cdist_abs_mydir/../core" && pwd -P)"} +: ${__cdist_core_dir:="$(cd "$__cdist_abs_mydir/../$__cdist_name_core_dir" && pwd -P)"} : ${__cdist_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer} : ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest} @@ -135,6 +136,7 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX") : ${__cdist_remote_base_dir:=/var/lib/cdist} : ${__cdist_remote_bin_dir:=$__cdist_remote_base_dir/$__cdist_name_bin} : ${__cdist_remote_conf_dir:=$__cdist_remote_base_dir/$__cdist_name_conf_dir} +: ${__cdist_remote_core_dir:=$__cdist_remote_base_dir/$__cdist_name_core_dir} : ${__cdist_remote_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer} : ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type} diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index b28afbf2..d94cf460 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -37,6 +37,9 @@ export $__cdist_name_var_target_user="$__cdist_remote_user" # Export variables for core, which others do not reset export __cdist_local_base_dir +# Load library always from the checkout +export __cdist_core_dir + __cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " ################################################################################ @@ -47,8 +50,10 @@ __cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " __cdist_init_deploy "$__cdist_target_host" # Transfer cdist executables -__cdist_echo info "Transferring cdist binaries to the target host " +__cdist_echo info "Transferring cdist binaries/functions to the target host " __cdist_dir push "${__cdist_abs_mydir}" "${__cdist_remote_bin_dir}" +__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_target_host" cdist-object-prepare diff --git a/core/__cdist_dir b/core/__cdist_dir index 7799d03e..2f08a95c 100755 --- a/core/__cdist_dir +++ b/core/__cdist_dir @@ -26,28 +26,26 @@ __cdist_dir() { - [ $# -eq 4 ] || __cdist_usage " " - set -ue + [ $# -eq 3 ] || __cdist_usage " " - __cdist_action="$1"; shift - __cdist_target_host="$1"; shift - __cdist_src_dir="$1"; shift - __cdist_dst_dir="$1"; shift + __cdist_dir_action="$1"; shift + __cdist_dir_src="$1"; shift + __cdist_dir_dst="$1"; shift # This will be the destination directory, so no subdirectories # of the same name are created, if the directory is already existing - __cdist_top_dir="${__cdist_dst_dir%/*}" + __cdist_dir_top="${__cdist_dir_dst%/*}" - if [ "$__cdist_action" = "push" ]; then + if [ "$__cdist_dir_action" = "push" ]; then ssh "${__cdist_remote_user}@${__cdist_target_host}" \ - "mkdir -p \"${__cdist_dst_dir}\"" - scp -qr "$__cdist_src_dir" \ - "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_top_dir}" - elif [ "$__cdist_action" = "pull" ]; then - mkdir -p "${__cdist_dst_dir}" - scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_src_dir}" \ - "${__cdist_top_dir}" + "mkdir -p \"${__cdist_dir_dst}\"" + scp -qr "$__cdist_dir_src" \ + "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_dir_top}" + elif [ "$__cdist_dir_action" = "pull" ]; then + mkdir -p "${__cdist_dir_dst}" + scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_dir_src}" \ + "${__cdist_dir_top}" else - __cdist_exit_err "Unknown action $__cdist_action" + __cdist_exit_err "Unknown action $__cdist_dir_action" fi }