From 2f926582e0cf69552fd57314811d3da888d118dc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 8 Feb 2011 00:08:05 +0100 Subject: [PATCH] +mass cleanup Signed-off-by: Nico Schottelius --- HACKERS_README | 12 +++++++----- bin/cdist-manifest-recursive-run | 10 +++++----- bin/cdist-manifest-run | 1 - conf/manifests/init | 2 ++ doc/man/cdist-manifests.text | 2 ++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/HACKERS_README b/HACKERS_README index 20c1c051..0015031c 100644 --- a/HACKERS_README +++ b/HACKERS_README @@ -13,19 +13,21 @@ What you can do so far: (executed from top level directory) # prepare use: export PATH="$PATH:$(pwd -P)/bin" +object_tmp=/tmp/localhost/objects +explorer_tmp=/tmp/localhost/explorers # Test first level manifest execution -__cdist_config=$(pwd -P)/conf __cdist_target_host=localhost cdist-manifest-init +__cdist_config=$(pwd -P)/conf cdist-manifest-init localhost $object_tmp # See what it generated -find conf/cache +find $object_tmp # Run explorer on a "remote" host -__cdist_config=$(pwd -P)/conf __cdist_target_host=localhost cdist-explorer-run +__cdist_config=$(pwd -P)/conf cdist-explorer-run localhost $explorer_tmp # Display result -find conf/cache/hosts/localhost +find $explorer_tmp # Soon working: -__cdist_config=$(pwd -P)/conf __cdist_target_host=localhost cdist-manifest-recursive-run ~/p/cdist/conf/cache/hosts/localhost/objects +__cdist_config=$(pwd -P)/conf cdist-manifest-recursive-run localhost $object_tmp diff --git a/bin/cdist-manifest-recursive-run b/bin/cdist-manifest-recursive-run index 1c0027d4..21a2c08e 100755 --- a/bin/cdist-manifest-recursive-run +++ b/bin/cdist-manifest-recursive-run @@ -29,12 +29,13 @@ . cdist-config -if [ $# -ne 1 ]; then - __cdist_usage "" +if [ $# -ne 2 ]; then + __cdist_usage " " fi set -eu +__cdist_target_host="$1"; shift __cdist_object_dir="$1"; shift # change to directory containing objects @@ -67,7 +68,7 @@ while [ "$__cdist_object_created_new" = 1 ]; do if [ -x "${manifest}" ]; then echo "Running manifest of type ${type} ..." - cdist-manifest-run "${__cdist_tmp_dir}" "${manifest}" + cdist-manifest-run "$__cdist_target_host" "${manifest}" "${__cdist_tmp_dir}" echo "Trying to merge... " @@ -80,8 +81,7 @@ while [ "$__cdist_object_created_new" = 1 ]; do while read newobject; do if [ -e "$__cdist_object_dir/${newobject}" ]; then - echo FAIIIIIIIIL - exit 23 + __cdist_exit_err "${newobject} already exists, merge failed." else # Fine, merge back! pax -r -w "$newobject" "$__cdist_object_dir" diff --git a/bin/cdist-manifest-run b/bin/cdist-manifest-run index ba9eb9e6..4bdbde79 100755 --- a/bin/cdist-manifest-run +++ b/bin/cdist-manifest-run @@ -28,7 +28,6 @@ if [ $# -ne 3 ]; then __cdist_usage " " fi -set -x set -aeu export __cdist_target_host="$1"; shift diff --git a/conf/manifests/init b/conf/manifests/init index 2923ba88..9e8ed4bb 100755 --- a/conf/manifests/init +++ b/conf/manifests/init @@ -2,6 +2,8 @@ # This is a sample manifest, but used in real world # +set -x + # All ikqs get a sample file case "$__cdist_target_host" in ikq*|localhost) diff --git a/doc/man/cdist-manifests.text b/doc/man/cdist-manifests.text index 1e3ce3cb..852de7ec 100644 --- a/doc/man/cdist-manifests.text +++ b/doc/man/cdist-manifests.text @@ -30,6 +30,8 @@ unsorted: cache / objects myhost/__file/cdist_bin/destination ... +-------------------------------------------------------------------------------- + ENVIRONMENT -----------