From 9955dc74c670d25270ada8bab2b280753143f33e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 Mar 2011 18:43:08 +0200 Subject: [PATCH 1/6] cleanups in bin/ Signed-off-by: Nico Schottelius --- bin/cdist-code-run | 1 - bin/cdist-deploy-to | 6 +++--- bin/cdist-dir | 5 +---- doc/dev/todo/TAKEME | 3 +++ 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/cdist-code-run b/bin/cdist-code-run index db1a2378..54cb312f 100755 --- a/bin/cdist-code-run +++ b/bin/cdist-code-run @@ -36,7 +36,6 @@ code="$(__cdist_object_code "$__cdist_object")-${__cdist_gencode_type}" echo "Checking code-${__cdist_gencode_type} for $__cdist_object ..." - if [ -e "$code" ]; then if [ -f "$code" ]; then if [ -x "$code" ]; then diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index aeae3b6c..02fd34fa 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -18,7 +18,7 @@ # along with cdist. If not, see . # # -# Apply configuration to a host +# Deploy configuration to a host # . cdist-config @@ -45,8 +45,8 @@ __cdist_init_deploy "$__cdist_target_host" # Transfer cdist executables echo "Transferring cdist binaries to $__cdist_target_host ..." -cdist-dir push "$__cdist_target_host" "${__cdist_abs_mydir}" "${__cdist_remote_bin_dir}" - +cdist-dir push "$__cdist_target_host" \ + "${__cdist_abs_mydir}" "${__cdist_remote_bin_dir}" cdist-explorer-run-global "$__cdist_target_host" cdist-manifest-run-init "$__cdist_target_host" cdist-object-all "$__cdist_target_host" cdist-object-process diff --git a/bin/cdist-dir b/bin/cdist-dir index 72f4730b..0d30e14a 100755 --- a/bin/cdist-dir +++ b/bin/cdist-dir @@ -25,14 +25,11 @@ . cdist-config -if [ $# -ne 4 ]; then - __cdist_usage " " -fi +[ $# -eq 4 ] || __cdist_usage " " set -ue __cdist_action="$1"; shift __cdist_target_host="$1"; shift - __cdist_src_dir="$1"; shift __cdist_dst_dir="$1"; shift diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index e85ddebd..7807c9e0 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -10,6 +10,9 @@ CORE __cdist_echo [level] [messages...] level := syslog alike: debug, notice, err +- Think about moving cdist-type-build-emulation out of cdist-manifest-run to + cdist-deploy-to: more dependency of cdist-manifest-run, but a lot of + less cycles consumed TYPES ------ From b3d7cf31925767be55f6baf399326722eb3c2432 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 Mar 2011 19:35:26 +0200 Subject: [PATCH 2/6] more cleanups, __cdist prefixes Signed-off-by: Nico Schottelius --- bin/cdist-object-explorer-run | 7 +++---- bin/cdist-object-gencode-run | 10 +++++----- doc/dev/todo/TAKEME | 3 +++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/cdist-object-explorer-run b/bin/cdist-object-explorer-run index ff0668e5..4d8e2321 100755 --- a/bin/cdist-object-explorer-run +++ b/bin/cdist-object-explorer-run @@ -32,7 +32,6 @@ __cdist_object="$1"; shift __object_id="$(__cdist_object_id_from_object "$__cdist_object")" __cdist_type="$(__cdist_type_from_object "$__cdist_object")" - # Check if type of object has >= 1 explorer __cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")" # Run the type explorers for the current object if any @@ -47,8 +46,8 @@ if [ "$__cdist_has_explorer" ]; then echo "Running explorers for $__cdist_object ..." # Copy object parameters - cdist-dir push "$__cdist_target_host" \ - "$(__cdist_object_parameter_dir "$__cdist_object")" \ + cdist-dir push "$__cdist_target_host" \ + "$(__cdist_object_parameter_dir "$__cdist_object")" \ "$(__cdist_remote_object_parameter_dir "$__cdist_object")" # Execute explorers @@ -62,7 +61,7 @@ if [ "$__cdist_has_explorer" ]; then "$(__cdist_remote_object_type_explorer_dir "$__cdist_object")" # Copy back results - cdist-dir pull "$__cdist_target_host" \ + cdist-dir pull "$__cdist_target_host" \ "$(__cdist_remote_object_type_explorer_dir "$__cdist_object")" \ "$(__cdist_object_type_explorer_dir "$__cdist_object")" fi diff --git a/bin/cdist-object-gencode-run b/bin/cdist-object-gencode-run index bfc65730..4d21fec9 100755 --- a/bin/cdist-object-gencode-run +++ b/bin/cdist-object-gencode-run @@ -29,15 +29,15 @@ set -eu __cdist_target_host="$1"; shift __cdist_object="$1"; shift -code_local="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_local}" -code_remote="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_remote}" +__cdist_code_local="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_local}" +__cdist_code_remote="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_remote}" echo "Generating local code for $__cdist_object ..." cdist-object-gencode "$__cdist_target_host" "$__cdist_object" \ - "${__cdist_name_gencode_local}" > "${code_local}" + "${__cdist_name_gencode_local}" > "${__cdist_code_local}" echo "Generating remote code for $__cdist_object ..." cdist-object-gencode "$__cdist_target_host" "$__cdist_object" \ - "${__cdist_name_gencode_remote}" > "${code_remote}" + "${__cdist_name_gencode_remote}" > "${__cdist_code_remote}" -chmod u+x "${code_local}" "${code_remote}" +chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}" diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 7807c9e0..4dc5b53b 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -14,6 +14,9 @@ CORE cdist-deploy-to: more dependency of cdist-manifest-run, but a lot of less cycles consumed +- cdist-object-gencode: remove code if output empty? + - also take care of that in cdist-code-run! + TYPES ------ Types to be written/extended: From 5359ed863cde6f920e0e59ec474e8a3ddbe9dfc6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 Mar 2011 20:21:08 +0200 Subject: [PATCH 3/6] +cleanups++ Signed-off-by: Nico Schottelius --- bin/cdist-object-manifest-run | 2 +- bin/cdist-object-process | 2 +- doc/dev/todo/TAKEME | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/cdist-object-manifest-run b/bin/cdist-object-manifest-run index 25378eb2..74a81469 100755 --- a/bin/cdist-object-manifest-run +++ b/bin/cdist-object-manifest-run @@ -46,12 +46,12 @@ if [ -f "$__cdist_manifest" ]; then export __cdist_manifest echo "Executing manifest ${__cdist_manifest} ..." - # Make variables available to non-core - FIXME: beatify export $__cdist_name_var_object="$__cdist_cur_object_dir" export $__cdist_name_var_object_id="$__cdist_object_id" export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")" cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest" + # Tell cdist-object-run-all that there may be new objects touch "$__cdist_objects_created" else diff --git a/bin/cdist-object-process b/bin/cdist-object-process index d10840e8..777d2c88 100755 --- a/bin/cdist-object-process +++ b/bin/cdist-object-process @@ -31,7 +31,7 @@ set -eu __cdist_target_host="$1"; shift __cdist_object="$1"; shift __cdist_object_dir="$(__cdist_object_dir "$__cdist_object")" -[ -d "$__cdist_object_dir" ] || __cdist_exit_err "Requested object is not defined: $__cdist_object" +[ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined: $__cdist_object" # Export to non-core for use in manifest and gencode scripts export $__cdist_name_var_self=$__cdist_object diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 4dc5b53b..03c4f244 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -16,6 +16,7 @@ CORE - cdist-object-gencode: remove code if output empty? - also take care of that in cdist-code-run! +- cdist-object-process -> cdist-object-prepare TYPES ------ From 7d0877d8ceb4055e6267632689034fdc65a2a3af Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 Mar 2011 20:29:22 +0200 Subject: [PATCH 4/6] ++cleanups Signed-off-by: Nico Schottelius --- bin/cdist-object-manifest-run | 3 --- bin/cdist-object-run | 3 +-- bin/cdist-type-emulator | 1 - bin/cdist-type-template | 1 - doc/dev/todo/TAKEME | 9 ++++++++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/cdist-object-manifest-run b/bin/cdist-object-manifest-run index 74a81469..ce44cbbc 100755 --- a/bin/cdist-object-manifest-run +++ b/bin/cdist-object-manifest-run @@ -29,10 +29,7 @@ set -eu __cdist_target_host="$1"; shift __cdist_object="$1"; shift -# Full path to current object __cdist_cur_object_dir="$(__cdist_object_dir "$__cdist_object")" - -# Only the id __cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object")" echo "Checking manifest for $__cdist_object ..." diff --git a/bin/cdist-object-run b/bin/cdist-object-run index 6c159ecf..667bf386 100755 --- a/bin/cdist-object-run +++ b/bin/cdist-object-run @@ -41,8 +41,7 @@ export $__cdist_name_var_self=$__cdist_object __cdist_object_finished="$(__cdist_object_finished "$__cdist_object")" if [ ! -f "$__cdist_object_finished" ]; then - - # Resolve dependencies if any + # Resolve dependencies, if any __cdist_object_require="$(__cdist_object_require "$__cdist_object")" if [ -f "$__cdist_object_require" ]; then echo diff --git a/bin/cdist-type-emulator b/bin/cdist-type-emulator index d0464533..2dcb47b3 100755 --- a/bin/cdist-type-emulator +++ b/bin/cdist-type-emulator @@ -53,7 +53,6 @@ if [ "$(echo $__cdist_object_id | grep "^/")" ]; then else __cdist_object_self="${__cdist_type}/${__cdist_object_id}" fi - ################################################################################ # Internal quirks # diff --git a/bin/cdist-type-template b/bin/cdist-type-template index cd34027c..dc853614 100755 --- a/bin/cdist-type-template +++ b/bin/cdist-type-template @@ -27,7 +27,6 @@ set -eu __cdist_type="$1"; shift - # Base mkdir -p "$(__cdist_type_dir "$__cdist_type")" diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 03c4f244..e4edeabe 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -6,10 +6,11 @@ Feel free to pick one! CORE ---- - Only build manpages if necessary for types as well as for the core! -- Add echo function: +- Add echo function / beautify output __cdist_echo [level] [messages...] level := syslog alike: debug, notice, err + Include object_self prefixing, if given! - Think about moving cdist-type-build-emulation out of cdist-manifest-run to cdist-deploy-to: more dependency of cdist-manifest-run, but a lot of less cycles consumed @@ -17,6 +18,12 @@ CORE - cdist-object-gencode: remove code if output empty? - also take care of that in cdist-code-run! - cdist-object-process -> cdist-object-prepare +- Remove cdist-object-push, covers only one line and is used only once: + [20:22] kr:bin% grep cdist-object-push * + cdist-object-run: cdist-object-push "$__cdist_target_host" "$__cdist_object" + [20:22] kr:bin% + +- probably remove or improve cdist-type-template TYPES ------ From dbed2f1f83b0729ca57a57b3c37e269f658bef98 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 Mar 2011 21:44:44 +0200 Subject: [PATCH 5/6] 1.5 not yet released, correct changelog Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index d3091fd7..5e0e2314 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -1.5.0: 2011-03-29 +1.5.0: * Add basic cache functionality * New type __process * Restructured execution: (Steven Armstrong) From a648aa5333d331123f7e4da00bb562b710ea8d18 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 Mar 2011 22:25:56 +0200 Subject: [PATCH 6/6] fix cdist-object-all: ensure output directory exists Signed-off-by: Nico Schottelius --- bin/cdist-object-all | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/cdist-object-all b/bin/cdist-object-all index 28df0613..391c9cc7 100755 --- a/bin/cdist-object-all +++ b/bin/cdist-object-all @@ -31,6 +31,9 @@ __cdist_command="$1"; shift __cdist_objects="$__cdist_tmp_dir/objects" +# Ensure object dir exists, so marker can be created +mkdir -p "${__cdist_out_object_dir}" + # Loop until we do not create new objects anymore # which is equal to all objects have been run touch "$__cdist_objects_created"