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 [ -f "$code" ]; then
if [ -x "$code" ]; then if [ -x "$code" ]; then
echo "Executing code-${__cdist_gencode_type} for $__cdist_object ..." echo "Executing code-${__cdist_gencode_type} for $__cdist_object ..."
"$code" __cdist_exec_fail_on_error "$code"
else else
__cdist_exit_err "$code exists, but is not executable." __cdist_exit_err "$code exists, but is not executable."
fi fi

View file

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

View file

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