finished migration of cdist-dir to __cdist_dir

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-06-14 00:28:08 +02:00
parent 6a500d5570
commit cf88f9cacb
3 changed files with 23 additions and 18 deletions

View file

@ -44,6 +44,7 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
: ${__cdist_name_cache:=cache} : ${__cdist_name_cache:=cache}
: ${__cdist_name_code:=code} : ${__cdist_name_code:=code}
: ${__cdist_name_conf_dir:=conf} : ${__cdist_name_conf_dir:=conf}
: ${__cdist_name_core_dir:=core}
: ${__cdist_name_dot_cdist:=.cdist} : ${__cdist_name_dot_cdist:=.cdist}
: ${__cdist_name_explorer:=explorer} : ${__cdist_name_explorer:=explorer}
: ${__cdist_name_gencode:=gencode} : ${__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_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache}
: ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"} : ${__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_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer}
: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest} : ${__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_base_dir:=/var/lib/cdist}
: ${__cdist_remote_bin_dir:=$__cdist_remote_base_dir/$__cdist_name_bin} : ${__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_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_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer}
: ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type} : ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type}

View file

@ -37,6 +37,9 @@ export $__cdist_name_var_target_user="$__cdist_remote_user"
# Export variables for core, which others do not reset # Export variables for core, which others do not reset
export __cdist_local_base_dir 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 " __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" __cdist_init_deploy "$__cdist_target_host"
# Transfer cdist executables # 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_abs_mydir}" "${__cdist_remote_bin_dir}"
__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_target_host" cdist-object-prepare cdist-object-all "$__cdist_target_host" cdist-object-prepare

View file

@ -26,28 +26,26 @@
__cdist_dir() __cdist_dir()
{ {
[ $# -eq 4 ] || __cdist_usage "<push|pull> <target host> <src dir> <dst dir>" [ $# -eq 3 ] || __cdist_usage "<push|pull> <src dir> <dst dir>"
set -ue
__cdist_action="$1"; shift __cdist_dir_action="$1"; shift
__cdist_target_host="$1"; shift __cdist_dir_src="$1"; shift
__cdist_src_dir="$1"; shift __cdist_dir_dst="$1"; shift
__cdist_dst_dir="$1"; shift
# This will be the destination directory, so no subdirectories # This will be the destination directory, so no subdirectories
# of the same name are created, if the directory is already existing # 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}" \ ssh "${__cdist_remote_user}@${__cdist_target_host}" \
"mkdir -p \"${__cdist_dst_dir}\"" "mkdir -p \"${__cdist_dir_dst}\""
scp -qr "$__cdist_src_dir" \ scp -qr "$__cdist_dir_src" \
"${__cdist_remote_user}@${__cdist_target_host}:${__cdist_top_dir}" "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_dir_top}"
elif [ "$__cdist_action" = "pull" ]; then elif [ "$__cdist_dir_action" = "pull" ]; then
mkdir -p "${__cdist_dst_dir}" mkdir -p "${__cdist_dir_dst}"
scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_src_dir}" \ scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_dir_src}" \
"${__cdist_top_dir}" "${__cdist_dir_top}"
else else
__cdist_exit_err "Unknown action $__cdist_action" __cdist_exit_err "Unknown action $__cdist_dir_action"
fi fi
} }