global explorers work again

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-06-17 14:51:32 +02:00
parent 29e029a2eb
commit 390d527515
2 changed files with 36 additions and 13 deletions

View file

@ -23,15 +23,38 @@
__cdist_explorer_run() __cdist_explorer_run()
{ {
[ $# -eq 3 ] || __cdist_usage "<global|type> <explorer dir> <out dir>" # [ $# -eq 3 ] || __cdist_usage "<global|type> <explorer dir> <out dir>"
[ $# -eq 5 ] || __cdist_usage "<global|type> <local explorer dir> <remote explorer dir> <remote out dir> <local out dir>"
set -x
case "$1" in # Only do something, if there's at least one entry
global) [ "$(__cdist_dir_listing "$2")" ] || return
type)
"$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" # Transfer explorers
*) __cdist_dir push "$2" "$3"
;;
esac # Create output directory
__cdist_run_remote mkdir -p "$4"
# Execute all explorers
cd "$2";
for __cdist_explorer_run_explorer in *; do
__cdist_run_remote "$3/$__cdist_explorer_run_explorer" ">" \
"$4/$__cdist_explorer_run_explorer"
done
# Transfer results back
__cdist_dir pull "$4" "$5"
return
# case "$1" in
# global)
# type)
# "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\""
# *)
# ;;
# esac
# Variable that defines the home of the explorers # Variable that defines the home of the explorers
@ -47,7 +70,6 @@ __cdist_explorer_run()
export $__cdist_variable_name="$__cdist_explorer_dir" export $__cdist_variable_name="$__cdist_explorer_dir"
export __global="$__cdist_remote_out_dir" export __global="$__cdist_remote_out_dir"
# mkdir -p "$__cdist_my_out_dir"
# Ensure there is at least one explorer # Ensure there is at least one explorer
num="$(ls -1 "$__cdist_explorer_dir" | wc -l)" num="$(ls -1 "$__cdist_explorer_dir" | wc -l)"

View file

@ -26,12 +26,13 @@ __cdist_explorer_run_global()
__cdist_echo info "Running global explorers " __cdist_echo info "Running global explorers "
# copy the explorers # copy the explorers
__cdist_dir push "${__cdist_explorer_dir}" "${__cdist_remote_explorer_dir}" # __cdist_dir push "${__cdist_explorer_dir}" "${__cdist_remote_explorer_dir}"
# run the global explorers remotely # run the global explorers remotely
__cdist_explorer_run global "$__cdist_remote_explorer_dir" \ __cdist_explorer_run global \
"$__cdist_remote_out_explorer_dir" "$__cdist_explorer_dir" "$__cdist_remote_explorer_dir" \
"$__cdist_remote_out_explorer_dir" "$__cdist_out_explorer_dir"
# retrieve the results # retrieve the results
__cdist_dir pull "${__cdist_remote_out_explorer_dir}" "${__cdist_out_explorer_dir}" # __cdist_dir pull "${__cdist_remote_out_explorer_dir}" "${__cdist_out_explorer_dir}"
} }