From 10bdef0edd35594f15ca442de6d122414f47cb5e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 Feb 2011 23:21:25 +0100 Subject: [PATCH] HUGE CLEANUP Signed-off-by: Nico Schottelius --- bin/cdist-deploy-to | 2 +- bin/cdist-explorer-run-global | 87 ----------------------------------- bin/cdist-explorer-run-init | 33 +++++++++++++ 3 files changed, 34 insertions(+), 88 deletions(-) delete mode 100755 bin/cdist-explorer-run-global create mode 100755 bin/cdist-explorer-run-init diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index dab3684b..2744c7c5 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -36,7 +36,7 @@ export __cdist_out_objects export __cdist_out_execs # See cdist-stages(7) -cdist-explorer-run "$__cdist_target_host" "$__cdist_out_explorers" +cdist-explorer-run-init "$__cdist_target_host" "$__cdist_out_explorers" cdist-manifest-init "$__cdist_target_host" "$__cdist_out_objects" cdist-manifest-run-all "$__cdist_target_host" "$__cdist_out_objects" cdist-object-codegen-all "$__cdist_target_host" "$__cdist_out_objects" "$__cdist_out_execs" diff --git a/bin/cdist-explorer-run-global b/bin/cdist-explorer-run-global deleted file mode 100755 index e4dc8cd1..00000000 --- a/bin/cdist-explorer-run-global +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the global explorers, i.e. not bound to types -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -ue - -export __cdist_target_host="$1"; shift -export __cdist_output_dir="$1"; shift - - -# create basedir -ssh root@${__cdist_target_host} "mkdir -p \"${__cdist_remote_base_dir}\" \ - \"${__cdist_remote_cache_dir}\" \"${__cdist_remote_cache_bin}\" \ - \"${__cdist_remote_cache_explorer}\"" - -# Transfer all explorers to the target dir - must be one level above, so -# coyping it multiple times works: a -> remote:/base/ = remote:/base/a vs. -# a -> remote:/base/a = remote:/base/a/a (second copy) - -# FIXME: enable -q as soon as the code is cleaned up -scp -r "${__cdist_explorer_dir}" \ - "root@${__cdist_target_host}:${__cdist_remote_base_dir}" - -# Transfer cdist binaries - FIXME: should transfer all (needed?) of them! -scp "$(which cdist-explorer-coordinator)" "$(which cdist-config)" \ - "root@${__cdist_target_host}:${__cdist_remote_cache_bin}" - -# Execute explorer coordinator, which will save results on target -ssh root@${__cdist_target_host} \ - "PATH=\"${__cdist_remote_cache_bin}:\$PATH\" - \"${__cdist_remote_cache_bin}/cdist-explorer-coordinator\" \ - \"${__cdist_remote_explorer_dir}\" \"${__cdist_remote_cache_explorer}\"" - -# Ensure local destination directory exists -mkdir -p "$__cdist_output_dir" - -# FIXME: enable -q as soon as the code is cleaned up -# Transfer back all results - FIXME: Add 2 level cache, so old version is kept until success -scp -r "root@${__cdist_target_host}:${__cdist_remote_cache_explorer}/*" \ - "$__cdist_output_dir" - - -exit 0 - -# -------------------------------------------------------------------------------- -# old idea with shell scripts (also sexy) -# Keep until above version successfully works - - -cd "${__cdist_explorer_dir}" -ls > "${__cdist_tmp_file}" - -# first load all functions -while read funcfull; do - cat "${funcfull}" -done < "${__cdist_tmp_file}" - -# then execute functions -while read funcfull; do - sh="${funcfull##*/}" - func="${sh%.sh}" - var="__$func" - - echo "$var=\"\$($func)\"" - echo "echo $var=\\\"\$$var\\\"" -done < "${CDIST_TMP}" diff --git a/bin/cdist-explorer-run-init b/bin/cdist-explorer-run-init new file mode 100755 index 00000000..e1ed2382 --- /dev/null +++ b/bin/cdist-explorer-run-init @@ -0,0 +1,33 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Run the global explorers, i.e. not bound to types +# + +. cdist-config +[ $# -eq 2 ] || __cdist_usage " " +set -ue + +__cdist_target_host="$1"; shift +__cdist_output_dir="$1"; shift + +cdist-explorer-run "$__cdist_target_host" \ + "$__cdist_explorer_dir" "$__cdist_output_dir" \ + "$__cdist_remote_explorer_dir" "$__cdist_remote_cache_explorer"