merge master

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-03-31 22:51:55 +02:00
commit 451e2b6fb4
13 changed files with 34 additions and 28 deletions

View file

@ -36,7 +36,6 @@ code="$(__cdist_object_code "$__cdist_object")-${__cdist_gencode_type}"
echo "Checking code-${__cdist_gencode_type} for $__cdist_object ..." echo "Checking code-${__cdist_gencode_type} for $__cdist_object ..."
if [ -e "$code" ]; then if [ -e "$code" ]; then
if [ -f "$code" ]; then if [ -f "$code" ]; then
if [ -x "$code" ]; then if [ -x "$code" ]; then

View file

@ -18,7 +18,7 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# Apply configuration to a host # Deploy configuration to a host
# #
. cdist-config . cdist-config
@ -45,8 +45,8 @@ __cdist_init_deploy "$__cdist_target_host"
# Transfer cdist executables # Transfer cdist executables
echo "Transferring cdist binaries to $__cdist_target_host ..." 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-explorer-run-global "$__cdist_target_host"
cdist-manifest-run-init "$__cdist_target_host" cdist-manifest-run-init "$__cdist_target_host"
cdist-object-all "$__cdist_target_host" cdist-object-process cdist-object-all "$__cdist_target_host" cdist-object-process

View file

@ -25,14 +25,11 @@
. cdist-config . cdist-config
if [ $# -ne 4 ]; then [ $# -eq 4 ] || __cdist_usage "<push|pull> <target host> <src dir> <dst dir>"
__cdist_usage "<push|pull> <target host> <src dir> <dst dir>"
fi
set -ue set -ue
__cdist_action="$1"; shift __cdist_action="$1"; shift
__cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
__cdist_src_dir="$1"; shift __cdist_src_dir="$1"; shift
__cdist_dst_dir="$1"; shift __cdist_dst_dir="$1"; shift

View file

@ -31,6 +31,9 @@ __cdist_command="$1"; shift
__cdist_objects="$__cdist_tmp_dir/objects" __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 # Loop until we do not create new objects anymore
# which is equal to all objects have been run # which is equal to all objects have been run
touch "$__cdist_objects_created" touch "$__cdist_objects_created"

View file

@ -32,7 +32,6 @@ __cdist_object="$1"; shift
__object_id="$(__cdist_object_id_from_object "$__cdist_object")" __object_id="$(__cdist_object_id_from_object "$__cdist_object")"
__cdist_type="$(__cdist_type_from_object "$__cdist_object")" __cdist_type="$(__cdist_type_from_object "$__cdist_object")"
# Check if type of object has >= 1 explorer # Check if type of object has >= 1 explorer
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")" __cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
# Run the type explorers for the current object if any # 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 ..." echo "Running explorers for $__cdist_object ..."
# Copy object parameters # Copy object parameters
cdist-dir push "$__cdist_target_host" \ cdist-dir push "$__cdist_target_host" \
"$(__cdist_object_parameter_dir "$__cdist_object")" \ "$(__cdist_object_parameter_dir "$__cdist_object")" \
"$(__cdist_remote_object_parameter_dir "$__cdist_object")" "$(__cdist_remote_object_parameter_dir "$__cdist_object")"
# Execute explorers # Execute explorers
@ -62,7 +61,7 @@ if [ "$__cdist_has_explorer" ]; then
"$(__cdist_remote_object_type_explorer_dir "$__cdist_object")" "$(__cdist_remote_object_type_explorer_dir "$__cdist_object")"
# Copy back results # Copy back results
cdist-dir pull "$__cdist_target_host" \ cdist-dir pull "$__cdist_target_host" \
"$(__cdist_remote_object_type_explorer_dir "$__cdist_object")" \ "$(__cdist_remote_object_type_explorer_dir "$__cdist_object")" \
"$(__cdist_object_type_explorer_dir "$__cdist_object")" "$(__cdist_object_type_explorer_dir "$__cdist_object")"
fi fi

View file

@ -29,15 +29,15 @@ set -eu
__cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
__cdist_object="$1"; shift __cdist_object="$1"; shift
code_local="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_local}" __cdist_code_local="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_local}"
code_remote="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_remote}" __cdist_code_remote="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_remote}"
echo "Generating local code for $__cdist_object ..." echo "Generating local code for $__cdist_object ..."
cdist-object-gencode "$__cdist_target_host" "$__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 ..." echo "Generating remote code for $__cdist_object ..."
cdist-object-gencode "$__cdist_target_host" "$__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}"

View file

@ -29,10 +29,7 @@ set -eu
__cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
__cdist_object="$1"; shift __cdist_object="$1"; shift
# Full path to current object
__cdist_cur_object_dir="$(__cdist_object_dir "$__cdist_object")" __cdist_cur_object_dir="$(__cdist_object_dir "$__cdist_object")"
# Only the id
__cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object")" __cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object")"
echo "Checking manifest for $__cdist_object ..." echo "Checking manifest for $__cdist_object ..."
@ -46,12 +43,12 @@ if [ -f "$__cdist_manifest" ]; then
export __cdist_manifest export __cdist_manifest
echo "Executing manifest ${__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="$__cdist_cur_object_dir"
export $__cdist_name_var_object_id="$__cdist_object_id" export $__cdist_name_var_object_id="$__cdist_object_id"
export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")" export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")"
cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest" cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest"
# Tell cdist-object-run-all that there may be new objects # Tell cdist-object-run-all that there may be new objects
touch "$__cdist_objects_created" touch "$__cdist_objects_created"
else else

View file

@ -31,7 +31,7 @@ set -eu
__cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
__cdist_object="$1"; shift __cdist_object="$1"; shift
__cdist_object_dir="$(__cdist_object_dir "$__cdist_object")" __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 to non-core for use in manifest and gencode scripts
export $__cdist_name_var_self=$__cdist_object export $__cdist_name_var_self=$__cdist_object

View file

@ -41,8 +41,7 @@ export $__cdist_name_var_self=$__cdist_object
__cdist_object_finished="$(__cdist_object_finished "$__cdist_object")" __cdist_object_finished="$(__cdist_object_finished "$__cdist_object")"
if [ ! -f "$__cdist_object_finished" ]; then if [ ! -f "$__cdist_object_finished" ]; then
# Resolve dependencies, if any
# Resolve dependencies if any
__cdist_object_require="$(__cdist_object_require "$__cdist_object")" __cdist_object_require="$(__cdist_object_require "$__cdist_object")"
if [ -f "$__cdist_object_require" ]; then if [ -f "$__cdist_object_require" ]; then
echo echo

View file

@ -53,7 +53,6 @@ if [ "$(echo $__cdist_object_id | grep "^/")" ]; then
else else
__cdist_object_self="${__cdist_type}/${__cdist_object_id}" __cdist_object_self="${__cdist_type}/${__cdist_object_id}"
fi fi
################################################################################ ################################################################################
# Internal quirks # Internal quirks
# #

View file

@ -27,7 +27,6 @@ set -eu
__cdist_type="$1"; shift __cdist_type="$1"; shift
# Base # Base
mkdir -p "$(__cdist_type_dir "$__cdist_type")" mkdir -p "$(__cdist_type_dir "$__cdist_type")"

View file

@ -1,4 +1,4 @@
1.5.0: 2011-03-29 1.5.0:
* Add basic cache functionality * Add basic cache functionality
* New type __process * New type __process
* Restructured execution: (Steven Armstrong) * Restructured execution: (Steven Armstrong)

View file

@ -5,10 +5,24 @@ Feel free to pick one!
CORE CORE
---- ----
- Add echo function: - Add echo function / beautify output
__cdist_echo [level] [messages...] __cdist_echo [level] [messages...]
level := syslog alike: level := syslog alike:
debug, notice, err 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
- 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 TYPES
------ ------