Merge remote branch 'nico/types_explorer' into types_explorer

This commit is contained in:
Steven Armstrong 2011-02-24 14:08:00 +01:00
commit b4348e06dd
8 changed files with 47 additions and 20 deletions

View file

@ -46,12 +46,14 @@ cdist-explorer-run-init "$__cdist_target_host" "$__cdist_out_explorer_dir"
# Create initial object base # Create initial object base
cdist-manifest-init "$__cdist_target_host" "$__cdist_out_object_dir" cdist-manifest-init "$__cdist_target_host" "$__cdist_out_object_dir"
# Create dependent objects # Create dependent objects - BUG: does not abort on error in manifest!!!!
cdist-manifest-run-all "$__cdist_target_host" "$__cdist_out_object_dir" cdist-manifest-run-all "$__cdist_target_host" "$__cdist_out_object_dir"
# Run explorer of each type for every object of types with explorer
cdist-object-explorer-all "$__cdist_target_host" "$__cdist_out_object_dir"
exit 2 exit 2
cdist-object-explorer-all "$__cdist_target_host" "$__cdist_out_object_dir"
cdist-object-codegen-all "$__cdist_target_host" "$__cdist_out_object_dir" "$__cdist_out_execs" cdist-object-codegen-all "$__cdist_target_host" "$__cdist_out_object_dir" "$__cdist_out_execs"
cdist-exec-transfer "$__cdist_target_host" "$__cdist_out_execs" cdist-exec-transfer "$__cdist_target_host" "$__cdist_out_execs"
cdist-exec-run "$__cdist_target_host" cdist-exec-run "$__cdist_target_host"

View file

@ -29,4 +29,5 @@ set -e
export __cdist_target_host="$1"; shift export __cdist_target_host="$1"; shift
export __cdist_output_dir="$1"; shift export __cdist_output_dir="$1"; shift
cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest_init" "$__cdist_output_dir" cdist-manifest-run "$__cdist_target_host" "$__cdist_local_base_dir" \
"$__cdist_manifest_init" "$__cdist_output_dir"

View file

@ -23,12 +23,13 @@
# #
. cdist-config . cdist-config
[ $# -ge 3 ] || __cdist_usage "<target host> <manifest> <outdir> [manifest arguments]" [ $# -ge 4 ] || __cdist_usage "<target host> <work dir> <manifest> <out dir> [manifest arguments]"
set -u set -u
export __cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
export __cdist_manifest="$1"; shift __cdist_work_dir="$1"; shift
export __cdist_output_dir="$1"; shift __cdist_manifest="$1"; shift
__cdist_output_dir="$1"; shift
# Ensure binaries exist and are up-to-date # Ensure binaries exist and are up-to-date
cdist-type-build-emulation || __cdist_exit_err "Failed to build type emulation binaries" cdist-type-build-emulation || __cdist_exit_err "Failed to build type emulation binaries"
@ -43,4 +44,5 @@ fi
mkdir -p "${__cdist_output_dir}" || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}" mkdir -p "${__cdist_output_dir}" || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}"
cd "$__cdist_work_dir" || __cdist_exit_err "Cannot change to work dir \"$__cdist_work_dir\"."
__cdist_exec_fail_on_error "${__cdist_manifest}" "$@" __cdist_exec_fail_on_error "${__cdist_manifest}" "$@"

View file

@ -60,17 +60,12 @@ while [ "$__cdist_new_objects_created" = "y" ]; do
__cdist_type="$(__cdist_type_from_object "$__cdist_object")" __cdist_type="$(__cdist_type_from_object "$__cdist_object")"
__cdist_manifest="$__cdist_type_dir/${__cdist_type}/${__cdist_name_manifest}" __cdist_manifest="$__cdist_type_dir/${__cdist_type}/${__cdist_name_manifest}"
echo $__cdist_manifest
if [ -x "${__cdist_manifest}" ]; then if [ -x "${__cdist_manifest}" ]; then
echo "Executing manifest ${__cdist_manifest} ..." echo "Executing manifest ${__cdist_manifest} ..."
# Safely change directory, convienent for type-writers cdist-manifest-run "$__cdist_target_host" "$__cdist_cur_object_dir" \
( "$__cdist_manifest" "$__cdist_new_objects_dir" "$__cdist_object_id"
cd "$__cdist_cur_object_dir"
cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest" \
"$__cdist_new_objects_dir" "$__cdist_object_id"
)
__cdist_object_list "${__cdist_new_objects_dir}" > "$__cdist_new_objects_list" __cdist_object_list "${__cdist_new_objects_dir}" > "$__cdist_new_objects_list"

View file

@ -28,6 +28,23 @@ set -eu
__cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
__cdist_object_base_dir="$1"; shift __cdist_object_base_dir="$1"; shift
################################################################################
# New code
#
# Get listing of objects
# Get listing of types used
# For every type that has explorers, Transfer the explorers
# For every object of a type that has explorers, execute the explorers
# and retrieve the results
################################################################################
# Old code
#
__cdist_object_list "$__cdist_object_base_dir" > "$__cdist_tmp_file" __cdist_object_list "$__cdist_object_base_dir" > "$__cdist_tmp_file"
# need to create pseudo array, as ssh in cdist-explorer-run will destroy while-read loops # need to create pseudo array, as ssh in cdist-explorer-run will destroy while-read loops

View file

@ -20,8 +20,9 @@
# #
destination=/etc/issue destination=/etc/issue
os="$(cat "out/explorers/os")"
case "$(cat "out/explorers/os")" in case "$os" in
archlinux) archlinux)
source="$(pwd -P)/files/archlinux" source="$(pwd -P)/files/archlinux"
;; ;;

14
doc/dev/logs/2011-02-24 Normal file
View file

@ -0,0 +1,14 @@
- Steven, Nico
- all cdist cores change to the local or remote base dir before excution
of non-core (i.e. manifests, gencode, ...) executables
- non-core executables get helper information via environment variables:
general explorers: __explorers
initial manifest: __manifests
type manifests: __object, __object_id
type explorers: __object, __object_id, __type_explorers
type codegen: __object, __object_id
type code: -

View file

@ -1,6 +1 @@
add explorers per type/object add explorers per type/object
- create clean trees locally and remote
- define paths in cdist-config
- rewrite cdist-explorer-run
- define helpers on the remote side (like cdist-explorer-coordinator)
- make cdist-config available / put helpers into path