define variables to be exported to types

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-17 16:42:59 +01:00
parent de43f4d5d8
commit bd026bad18
4 changed files with 30 additions and 28 deletions

View File

@ -30,37 +30,37 @@ set -e
export PATH="$PATH:$(pwd -P)/bin" export PATH="$PATH:$(pwd -P)/bin"
export __cdist_config="$(pwd -P)/conf" export __cdist_config="$(pwd -P)/conf"
object_tmp=/tmp/localhost/objects __cdist_out_objects=/tmp/localhost/objects
explorer_tmp=/tmp/localhost/explorers __cdist_out_explorers=/tmp/localhost/explorers
exec_tmp=/tmp/localhost/exec __cdist_out_execs=/tmp/localhost/exec
# Run explorer on a "remote" host # Run explorer on a "remote" host
cdist-explorer-run localhost "$explorer_tmp" cdist-explorer-run localhost "$__cdist_out_explorers"
# Display result # Display result
find "$explorer_tmp" find "$__cdist_out_explorers"
# Test first level manifest execution # Test first level manifest execution
cdist-manifest-init localhost "$object_tmp" cdist-manifest-init localhost "$__cdist_out_objects"
# See what it generated # See what it generated
find "$object_tmp" find "$__cdist_out_objects"
# Generate all objects, including from types that generate objects as well # 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 # See what it generated
find "$object_tmp" find "$__cdist_out_objects"
# Generate code for all objects in object dir # 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 # Display result, including permissions
ls -lR "$exec_tmp" ls -lR "$__cdist_out_execs"
# Transfer generated code # Transfer generated code
cdist-exec-transfer localhost "$exec_tmp" cdist-exec-transfer localhost "$__cdist_out_execs"
# Execute generated code # Execute generated code
cdist-exec-run localhost cdist-exec-run localhost

View File

@ -24,6 +24,11 @@ x run initial manifest (stage 2)
x find $object_id in recursive runner (before merge) 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 "cd $__object_dir, before running manifest" in doc/man/cdist-types.text
- DOC document that $type/manifest is executed for every object/instance - 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 generate code to be executed on clients (stage 4)
x for one object x for one object

View File

@ -23,26 +23,25 @@
. cdist-config . cdist-config
[ $# -eq 1 ] || __cdist_usage "<target host>" [ $# -eq 1 ] || __cdist_usage "<target host>"
set -eu set -e
__cdist_target_host="$1" __cdist_target_host="$1"
tmp_exp="$__cdist_tmp_dir/$__cdist_name_explorer" export __cdist_out_explorers="$__cdist_tmp_dir/$__cdist_name_explorer"
tmp_obj="$__cdist_tmp_dir/$__cdist_name_object" export __cdist_out_objects="$__cdist_tmp_dir/$__cdist_name_object"
tmp_exec="$__cdist_tmp_dir/$__cdist_name_exec" export __cdist_out_execs="$__cdist_tmp_dir/$__cdist_name_exec"
# See cdist-stages(7) # See cdist-stages(7)
cdist-explorer-run "$__cdist_target_host" "$tmp_exp" cdist-explorer-run "$__cdist_target_host" "$__cdist_out_explorers"
cdist-manifest-init "$__cdist_target_host" "$tmp_obj" cdist-manifest-init "$__cdist_target_host" "$__cdist_out_objects"
cdist-manifest-run-all "$__cdist_target_host" "$tmp_obj" cdist-manifest-run-all "$__cdist_target_host" "$__cdist_out_objects"
cdist-object-codegen-all "$__cdist_target_host" "$tmp_obj" "$tmp_exec" cdist-object-codegen-all "$__cdist_target_host" "$__cdist_out_objects" "$__cdist_out_execs"
cdist-object-codegen-all "$__cdist_target_host" "$tmp_obj" "$tmp_exec" cdist-exec-transfer "$__cdist_target_host" "$__cdist_out_execs"
cdist-exec-transfer "$__cdist_target_host" "$tmp_exec"
cdist-exec-run "$__cdist_target_host" cdist-exec-run "$__cdist_target_host"
# FIXME: Create new cache from results # FIXME: Create new cache from results
# echo rm -rf "$(__cdist_cache_host)" # echo rm -rf "$(__cdist_cache_host)"
# mkdir -p "$(__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 # Also save last code fragment
# mv "$tmp_code" "$(__cdist_cache_host)" # mv "$tmp_code" "$(__cdist_cache_host)"

View File

@ -19,16 +19,14 @@
# #
# #
. cdist-config
destination=/etc/issue destination=/etc/issue
case "$__cdist_explorer_os" in case "$(cat "$__cdist_out_explorers/os")" in
archlinux) archlinux)
source="$(__cdist_type_mydir)/files/archlinux" source="$(pwd -P)/files/archlinux"
;; ;;
*) *)
source="$(__cdist_type_mydir)/files/default" source="$(pwd -P)/files/default"
;; ;;
esac esac