begin integration of type|global support

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-06-17 14:28:10 +02:00
parent 3c903fae67
commit 83e75666c3

View file

@ -18,20 +18,24 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# This binary is executed on the remote side to execute explorers # Run explorers
#
# It supports different variables names to be used, so __explorers
# and __type_explorers can be submitted :-)
# #
__cdist_explorer_run() __cdist_explorer_run()
{ {
[ $# -eq 3 ] || __cdist_usage "<variable name> <explorer dir> <out dir>" [ $# -eq 3 ] || __cdist_usage "<global|type> <explorer dir> <out dir>"
case "$1" in
global)
type)
"$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\""
*)
;;
esac
"$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\""
# Variable that defines the home of the explorers # Variable that defines the home of the explorers
__cdist_variable_name="$1"; shift # __cdist_variable_name="$1"; shift
# Find explorers here # Find explorers here
__cdist_explorer_dir="$1"; shift __cdist_explorer_dir="$1"; shift
@ -39,11 +43,11 @@ __cdist_explorer_run()
# Write output here # Write output here
__cdist_my_out_dir="$1"; shift __cdist_my_out_dir="$1"; shift
# Setup environment # Setup remote environment
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" # 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)"