construct cache dir path in cdist-config, not cdist-cache

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-31 15:40:08 +02:00
parent e7ff4c37ff
commit dd176d7a64
2 changed files with 21 additions and 6 deletions

View file

@ -27,11 +27,11 @@
set -u set -u
__cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
__cdist_ddir="$(__cdist_host_cache_dir "$__cdist_target_host")"
mkdir -p "${__cdist_local_base_cache_dir}" # Create base to move into
__cdist_abs_cache_dir="$(cd "$__cdist_local_base_cache_dir" && pwd -P)" mkdir -p "$(__cdist_cache_dir)"
__cdist_abs_ddir="$__cdist_abs_cache_dir/$__cdist_target_host"
echo "Saving cache to $__cdist_abs_ddir ..." echo "Saving cache to $__cdist_ddir ..."
rm -rf "$__cdist_abs_ddir" rm -rf "$__cdist_ddir"
mv "$__cdist_local_base_dir" "$__cdist_abs_ddir" mv "$__cdist_local_base_dir" "$__cdist_ddir"

View file

@ -105,6 +105,8 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
# Local Base # Local Base
# #
: ${__cdist_local_base_dir:=$__cdist_tmp_dir} : ${__cdist_local_base_dir:=$__cdist_tmp_dir}
# Cache may *NOT* be below __cdist_local_base_dir!
: ${__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)"}
@ -186,6 +188,19 @@ __cdist_init_deploy()
ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir"
} }
################################################################################
# Cache
#
__cdist_cache_dir()
{
cd "${__cdist_local_base_cache_dir}" && pwd -P
}
__cdist_host_cache_dir()
{
echo "$(__cdist_cache_dir)/$1"
}
################################################################################ ################################################################################
# Object # Object
# #