Cleanup local and remote base_dir before execution

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-03 09:43:04 +01:00
parent 442a175755
commit f75f2a0de5
2 changed files with 20 additions and 10 deletions

View file

@ -128,6 +128,22 @@ __cdist_usage()
__cdist_exit_err "$__cdist_myname: $@"
}
__cdist_init_deploy()
{
echo "Creating clean directory structur ..."
# Ensure there is no old stuff, neither local nor remote
rm -rf "$__cdist_local_base_dir"
ssh "${__cdist_remote_user}@$1" "rm -rf ${__cdist_remote_base_dir}"
# Init base
mkdir -p "$__cdist_local_base_dir"
ssh "${__cdist_remote_user}@$1" "mkdir -p ${__cdist_remote_base_dir}"
# Link configuration source directory - consistent with remote
ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir"
}
# __cdist_cache_host()
# {
# echo "${__cdist_cache_hosts}/${__cdist_target_host}"

View file

@ -33,20 +33,14 @@ export $__cdist_name_var_target_host="$__cdist_target_host"
# Export variables for core, which others do not reset
export __cdist_local_base_dir
echo "cdist $__cdist_version: Configuring $__cdist_target_host"
################################################################################
# See cdist-stages(7)
#
echo "cdist $__cdist_version: Configuring $__cdist_target_host"
# Init base
mkdir -p "$__cdist_local_base_dir"
# Ensure there is no old link, otherwise the new link is created below the old
rm -f "$__cdist_local_base_dir/$__cdist_name_conf_dir"
# Link configuration source directory - consistent with remote
ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir"
# Prepare local and remote directories
__cdist_init_deploy "$__cdist_target_host"
# Transfer cdist "binaries"
cdist-bin-transfer "$__cdist_target_host" "$__cdist_remote_bin_dir"