forked from ungleich-public/cdist
load __cdist_dir from core
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
630fced69d
commit
abe6e695bc
2 changed files with 39 additions and 22 deletions
|
@ -111,6 +111,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_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer}
|
||||
: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest}
|
||||
|
@ -149,6 +150,15 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
|
|||
################################################################################
|
||||
# Internal functions
|
||||
#
|
||||
|
||||
# *NEW* Load functions from library
|
||||
for __cdist_lib in $__cdist_core_dir/*; do
|
||||
echo Loading $__cdist_lib ...
|
||||
. "$__cdist_lib"
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
__cdist_echo()
|
||||
{
|
||||
__cdist_echo_type="$1"; shift
|
||||
|
@ -208,6 +218,11 @@ __cdist_usage()
|
|||
__cdist_exit_err "$__cdist_myname: $@"
|
||||
}
|
||||
|
||||
___cdist_lib_path()
|
||||
{
|
||||
echo $_
|
||||
}
|
||||
|
||||
__cdist_init_deploy()
|
||||
{
|
||||
__cdist_echo info "Creating clean directory structure "
|
||||
|
|
|
@ -24,28 +24,30 @@
|
|||
#
|
||||
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 4 ] || __cdist_usage "<push|pull> <target host> <src dir> <dst dir>"
|
||||
set -ue
|
||||
__cdist_dir()
|
||||
{
|
||||
[ $# -eq 4 ] || __cdist_usage "<push|pull> <target host> <src dir> <dst dir>"
|
||||
set -ue
|
||||
|
||||
__cdist_action="$1"; shift
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_src_dir="$1"; shift
|
||||
__cdist_dst_dir="$1"; shift
|
||||
__cdist_action="$1"; shift
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_src_dir="$1"; shift
|
||||
__cdist_dst_dir="$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%/*}"
|
||||
# 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%/*}"
|
||||
|
||||
if [ "$__cdist_action" = "push" ]; then
|
||||
if [ "$__cdist_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
|
||||
elif [ "$__cdist_action" = "pull" ]; then
|
||||
mkdir -p "${__cdist_dst_dir}"
|
||||
scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_src_dir}" \
|
||||
"${__cdist_top_dir}"
|
||||
else
|
||||
else
|
||||
__cdist_exit_err "Unknown action $__cdist_action"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue