diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to
index 6b3f2ee1..baeff220 100755
--- a/bin/cdist-deploy-to
+++ b/bin/cdist-deploy-to
@@ -55,9 +55,9 @@ __cdist_dir push "${__cdist_abs_mydir}" "${__cdist_remote_bin_dir}"
__cdist_dir push "${__cdist_core_dir}" "${__cdist_remote_core_dir}"
cdist-explorer-run-global "$__cdist_target_host"
-__cdist_manifest_run_init "$__cdist_target_host"
+__cdist_manifest_run_init
__cdist_object_all __cdist_object_prepare
__cdist_object_all __cdist_object_run
-cdist-cache "$__cdist_target_host"
+__cdist_cache
__cdist_echo info "cdist $__cdist_version: Successfully finished run"
diff --git a/bin/cdist-explorer-run-global b/bin/cdist-explorer-run-global
index 09b088f5..51052627 100755
--- a/bin/cdist-explorer-run-global
+++ b/bin/cdist-explorer-run-global
@@ -33,9 +33,10 @@ __cdist_echo info "Running global explorers "
__cdist_dir push "${__cdist_explorer_dir}" "${__cdist_remote_explorer_dir}"
# run the initial explorers remotely
-cdist-run-remote "${__cdist_target_host}" cdist-remote-explorer-run \
+__cdist_run_remote "${__cdist_target_host}" cdist-remote-explorer-run \
"$__cdist_name_var_explorer" "$__cdist_remote_explorer_dir" \
"$__cdist_remote_out_explorer_dir"
+
# retrieve the results
__cdist_dir pull "${__cdist_remote_out_explorer_dir}" "${__cdist_out_explorer_dir}"
diff --git a/bin/cdist-remote b/bin/cdist-remote
index d95913ba..0a730a6e 100755
--- a/bin/cdist-remote
+++ b/bin/cdist-remote
@@ -18,51 +18,9 @@
# along with cdist. If not, see .
#
#
-# This binary is executed on the remote side to execute explorers
-#
-# It supports different variables names to be used, so __explorers
-# and __type_explorers can be submitted :-)
+# This scripts runs functions or binaries remotely
#
. cdist-config
-[ $# -eq 3 ] || __cdist_usage " "
-set -ue
-# Variable that defines the home of the explorers
-__cdist_variable_name="$1"; shift
-
-# Find explorers here
-__cdist_explorer_dir="$1"; shift
-
-# Write output here
-__cdist_my_out_dir="$1"; shift
-
-# Setup environment
-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)"
-if [ "$num" -lt 1 ]; then
- __cdist_exit_err "${__cdist_explorer_dir}: Contains no explorers"
-fi
-
-# Execute all explorers
-for explorer in "$__cdist_explorer_dir/"*; do
- explorer_name="${explorer##*/}"
-
- if [ -f "$explorer" ]; then
- if [ ! -x "$explorer" ]; then
- __cdist_exit_err "Explorer \"$explorer\" exists, but is not executable."
- fi
-
- # Execute explorers and save results in remote destination directory
- "$explorer" > "${__cdist_my_out_dir}/$explorer_name"
- else
- if [ -e "$explorer" ]; then
- __cdist_exit_err "Explorer \"$explorer\" exists, but is not a file."
- fi
- fi
-done
+"$@"
diff --git a/core/__cdist_object_code_run b/core/__cdist_object_code_run
index d25d1dca..c07505fe 100755
--- a/core/__cdist_object_code_run
+++ b/core/__cdist_object_code_run
@@ -32,6 +32,6 @@ __cdist_object_code_run()
__cdist_code_run "$__cdist_object_code_run_object" "${__cdist_name_gencode_local}"
# Code remote
- cdist-run-remote "$__cdist_target_host" \
- "cdist-code-run" "$__cdist_object_code_run_object" "${__cdist_name_gencode_remote}"
+ __cdist_run_remote "$__cdist_target_host" \
+ "__cdist_code_run" "$__cdist_object_code_run_object" "${__cdist_name_gencode_remote}"
}
diff --git a/core/__cdist_object_explorer_run b/core/__cdist_object_explorer_run
index f11c6786..eb62401e 100755
--- a/core/__cdist_object_explorer_run
+++ b/core/__cdist_object_explorer_run
@@ -49,7 +49,7 @@ __cdist_object_explorer_run()
"$(__cdist_remote_object_parameter_dir "$__cdist_object_self")"
# Execute explorers
- cdist-run-remote "$__cdist_target_host" \
+ __cdist_run_remote \
"$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" \
"$__cdist_name_var_object_id=\"$__cdist_object_id\"" \
"$__cdist_name_var_self=\"$__cdist_object_self\"" \
diff --git a/bin/cdist-run-remote b/core/__cdist_run_remote
similarity index 70%
rename from bin/cdist-run-remote
rename to core/__cdist_run_remote
index 4a4452a2..697a1d68 100755
--- a/bin/cdist-run-remote
+++ b/core/__cdist_run_remote
@@ -21,13 +21,13 @@
# Run a cdist binary on the remote side
#
-. cdist-config
-[ $# -ge 2 ] || __cdist_usage " [opts]"
-set -ue
+__cdist_run_remote()
+{
+ [ $# -ge 1 ] || __cdist_usage " [opts]"
-__cdist_target_host="$1"; shift
-
-ssh "${__cdist_remote_user}@${__cdist_target_host}" \
- "export PATH=\"${__cdist_remote_bin_dir}:\$PATH\";" \
- "export __cdist_out_object_dir=\"$__cdist_remote_out_object_dir\";" \
- "$@"
+ ssh "${__cdist_remote_user}@${__cdist_target_host}" \
+ "export PATH=\"${__cdist_remote_bin_dir}:\$PATH\";" \
+ "export __cdist_out_object_dir=\"$__cdist_remote_out_object_dir\";" \
+ ". cdist-config;" \
+ "$@"
+}