From 390d527515c1bd1828d76ebd1ab0a613ea3046a6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 17 Jun 2011 14:51:32 +0200 Subject: [PATCH] global explorers work again Signed-off-by: Nico Schottelius --- core/__cdist_explorer_run | 40 +++++++++++++++++++++++++------- core/__cdist_explorer_run_global | 9 +++---- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/core/__cdist_explorer_run b/core/__cdist_explorer_run index 6a580af3..a5545faf 100755 --- a/core/__cdist_explorer_run +++ b/core/__cdist_explorer_run @@ -23,15 +23,38 @@ __cdist_explorer_run() { - [ $# -eq 3 ] || __cdist_usage " " + # [ $# -eq 3 ] || __cdist_usage " " + [ $# -eq 5 ] || __cdist_usage " " + set -x - case "$1" in - global) - type) - "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" - *) - ;; - esac + # Only do something, if there's at least one entry + [ "$(__cdist_dir_listing "$2")" ] || return + + # Transfer explorers + __cdist_dir push "$2" "$3" + + # 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 @@ -47,7 +70,6 @@ __cdist_explorer_run() export $__cdist_variable_name="$__cdist_explorer_dir" export __global="$__cdist_remote_out_dir" - # mkdir -p "$__cdist_my_out_dir" # Ensure there is at least one explorer num="$(ls -1 "$__cdist_explorer_dir" | wc -l)" diff --git a/core/__cdist_explorer_run_global b/core/__cdist_explorer_run_global index dfbeb6ac..7265aee1 100755 --- a/core/__cdist_explorer_run_global +++ b/core/__cdist_explorer_run_global @@ -26,12 +26,13 @@ __cdist_explorer_run_global() __cdist_echo info "Running global 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 - __cdist_explorer_run global "$__cdist_remote_explorer_dir" \ - "$__cdist_remote_out_explorer_dir" + __cdist_explorer_run global \ + "$__cdist_explorer_dir" "$__cdist_remote_explorer_dir" \ + "$__cdist_remote_out_explorer_dir" "$__cdist_out_explorer_dir" # 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}" }