use __cdist_exec_fail_on_error in bin/cdist-code-run

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-04-06 20:11:39 +02:00
parent 08d18ec1ec
commit 813b4e1f2b
3 changed files with 11 additions and 9 deletions

View File

@ -40,7 +40,7 @@ if [ -e "$code" ]; then
if [ -f "$code" ]; then
if [ -x "$code" ]; then
echo "Executing code-${__cdist_gencode_type} for $__cdist_object ..."
"$code"
__cdist_exec_fail_on_error "$code"
else
__cdist_exit_err "$code exists, but is not executable."
fi

View File

@ -152,20 +152,24 @@ __cdist_echo()
{
__cdist_echo_type="$1"; shift
if [ "$__cdist_object_self" ]; then
__cdist_echo_prefix="$__cdist_object_self"
fi
case "$__cdist_echo_type" in
debug)
if [ "$__cdist_debug" ]; then
echo "Debug: $@"
echo $__cdist_echo_prefix "Debug: $@"
fi
;;
info)
echo "$@"
echo $__cdist_echo_prefix "$@"
;;
warning)
echo "Warning: $@"
echo $__cdist_echo_prefix "Warning: $@"
;;
error)
echo "Error: $@" >&2
echo $__cdist_echo_prefix "Error: $@" >&2
;;
esac
}

View File

@ -31,10 +31,8 @@ __cdist_object="$1"; shift
# Code local
export __cdist_out_object_dir="$__cdist_out_object_dir"
cdist-code-run "$__cdist_object" "${__cdist_name_gencode_local}" \
|| __cdist_exit_err "Local code failed for $__cdist_object"
cdist-code-run "$__cdist_object" "${__cdist_name_gencode_local}"
# Code remote
cdist-run-remote "$__cdist_target_host" \
"cdist-code-run" "$__cdist_object" "${__cdist_name_gencode_remote}" \
|| __cdist_exit_err "Remote code failed for $__cdist_object"
"cdist-code-run" "$__cdist_object" "${__cdist_name_gencode_remote}"