From 9761239f6c2d893a34b7b507e44f78f7b4d7b011 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 Feb 2011 09:02:57 +0100 Subject: [PATCH] in theory finish bin/cdist-object-explorer-all Signed-off-by: Nico Schottelius --- bin/cdist-object-explorer-all | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/bin/cdist-object-explorer-all b/bin/cdist-object-explorer-all index 000930c6..375b50d5 100755 --- a/bin/cdist-object-explorer-all +++ b/bin/cdist-object-explorer-all @@ -30,7 +30,7 @@ __cdist_object_base_dir="$1"; shift __cdist_object_list "$__cdist_object_base_dir" > "$__cdist_tmp_file" -# need to create pseudo array, as ssh will destroy while-read loops +# need to create pseudo array, as ssh in cdist-explorer-run will destroy while-read loops while read object; do set -- "$@" "$object" done < "$__cdist_tmp_file" @@ -39,19 +39,21 @@ while [ $# -gt 0 ]; do object="$1"; shift type=$(__cdist_type_from_object "$object") - local_src_dir="$__cdist_object_base_dir/${object}/${__cdist_name_explorer}" + local_src_dir="$(__cdist_type_explorer_dir "$type")" local_dst_dir="$__cdist_object_base_dir/${object}/${__cdist_name_explorer}" - # FIXME: stopped here - cdist-explorer-run "$__cdist_target_host" + remote_src_dir="$__cdist_remote_cache_dir/$__cdist_name_type/$type/$__cdist_name_explorer" + remote_dst_dir="$__cdist_remote_cache_dir/$__cdist_name_object/$object/$__cdist_name_explorer" - outfile="${outdir}/${__cdist_name_exec}" + if [ -d "$local_src_dir" ]; then + num="$(ls -1 "$local_src_dir" | wc -l)" - mkdir -p "${outdir}" + # Skip if there is not at least one explorer + if [ "$num" -lt 1 ]; then + continue + fi - cdist-object-codegen "$__cdist_target_host" \ - "$__cdist_object_base_dir" \ - "$object" > "${outfile}" - - chmod u+x "${outfile}" -done < "$__cdist_tmp_file" + cdist-explorer-run "$__cdist_target_host" \ + "$local_src_dir" "$local_dst_dir" "$remote_src_dir" "$remote_dst_dir" + fi +done