From bd026bad189476159f5cf23f9d54a03fce9f7e9f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 17 Feb 2011 16:42:59 +0100 Subject: [PATCH] define variables to be exported to types Signed-off-by: Nico Schottelius --- HACKERS_README | 24 ++++++++++++------------ TODO-1.0 | 5 +++++ bin/cdist-deploy-to | 21 ++++++++++----------- conf/types/__issue/manifest | 8 +++----- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/HACKERS_README b/HACKERS_README index 3ddbd0b8..8efed967 100755 --- a/HACKERS_README +++ b/HACKERS_README @@ -30,37 +30,37 @@ set -e export PATH="$PATH:$(pwd -P)/bin" export __cdist_config="$(pwd -P)/conf" -object_tmp=/tmp/localhost/objects -explorer_tmp=/tmp/localhost/explorers -exec_tmp=/tmp/localhost/exec +__cdist_out_objects=/tmp/localhost/objects +__cdist_out_explorers=/tmp/localhost/explorers +__cdist_out_execs=/tmp/localhost/exec # Run explorer on a "remote" host -cdist-explorer-run localhost "$explorer_tmp" +cdist-explorer-run localhost "$__cdist_out_explorers" # Display result -find "$explorer_tmp" +find "$__cdist_out_explorers" # Test first level manifest execution -cdist-manifest-init localhost "$object_tmp" +cdist-manifest-init localhost "$__cdist_out_objects" # See what it generated -find "$object_tmp" +find "$__cdist_out_objects" # Generate all objects, including from types that generate objects as well -cdist-manifest-run-all localhost "$object_tmp" +cdist-manifest-run-all localhost "$__cdist_out_objects" # See what it generated -find "$object_tmp" +find "$__cdist_out_objects" # Generate code for all objects in object dir -cdist-object-codegen-all localhost "$object_tmp" "$exec_tmp" +cdist-object-codegen-all localhost "$__cdist_out_objects" "$__cdist_out_execs" # Display result, including permissions -ls -lR "$exec_tmp" +ls -lR "$__cdist_out_execs" # Transfer generated code -cdist-exec-transfer localhost "$exec_tmp" +cdist-exec-transfer localhost "$__cdist_out_execs" # Execute generated code cdist-exec-run localhost diff --git a/TODO-1.0 b/TODO-1.0 index e1721e7a..1c739474 100644 --- a/TODO-1.0 +++ b/TODO-1.0 @@ -24,6 +24,11 @@ x run initial manifest (stage 2) x find $object_id in recursive runner (before merge) - DOC document "cd $__object_dir, before running manifest" in doc/man/cdist-types.text - DOC document that $type/manifest is executed for every object/instance + - DOC: types can always access + __cdist_out_objects, __cdist_out_explorers, + __cdist_out_execs + + --> create cdist-variables document? x generate code to be executed on clients (stage 4) x for one object diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index d2d97c3e..d7917b87 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -23,26 +23,25 @@ . cdist-config [ $# -eq 1 ] || __cdist_usage "" -set -eu +set -e __cdist_target_host="$1" -tmp_exp="$__cdist_tmp_dir/$__cdist_name_explorer" -tmp_obj="$__cdist_tmp_dir/$__cdist_name_object" -tmp_exec="$__cdist_tmp_dir/$__cdist_name_exec" +export __cdist_out_explorers="$__cdist_tmp_dir/$__cdist_name_explorer" +export __cdist_out_objects="$__cdist_tmp_dir/$__cdist_name_object" +export __cdist_out_execs="$__cdist_tmp_dir/$__cdist_name_exec" # See cdist-stages(7) -cdist-explorer-run "$__cdist_target_host" "$tmp_exp" -cdist-manifest-init "$__cdist_target_host" "$tmp_obj" -cdist-manifest-run-all "$__cdist_target_host" "$tmp_obj" -cdist-object-codegen-all "$__cdist_target_host" "$tmp_obj" "$tmp_exec" -cdist-object-codegen-all "$__cdist_target_host" "$tmp_obj" "$tmp_exec" -cdist-exec-transfer "$__cdist_target_host" "$tmp_exec" +cdist-explorer-run "$__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" +cdist-exec-transfer "$__cdist_target_host" "$__cdist_out_execs" cdist-exec-run "$__cdist_target_host" # FIXME: Create new cache from results # echo rm -rf "$(__cdist_cache_host)" # mkdir -p "$(__cdist_cache_host)" -# mv "$tmp_exp" "$tmp_obj" "$(__cdist_cache_host)" +# mv "$__cdist_out_explorers" "$__cdist_out_objects" "$(__cdist_cache_host)" # Also save last code fragment # mv "$tmp_code" "$(__cdist_cache_host)" diff --git a/conf/types/__issue/manifest b/conf/types/__issue/manifest index f525c2df..735c04c8 100755 --- a/conf/types/__issue/manifest +++ b/conf/types/__issue/manifest @@ -19,16 +19,14 @@ # # -. cdist-config - destination=/etc/issue -case "$__cdist_explorer_os" in +case "$(cat "$__cdist_out_explorers/os")" in archlinux) - source="$(__cdist_type_mydir)/files/archlinux" + source="$(pwd -P)/files/archlinux" ;; *) - source="$(__cdist_type_mydir)/files/default" + source="$(pwd -P)/files/default" ;; esac