ensure failing if manifest or gencode break

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-17 16:26:48 +01:00
parent f392543d43
commit ff41ce0318
5 changed files with 25 additions and 16 deletions

View File

@ -21,8 +21,10 @@ I usually do it like this:
eof
# Tell the user what we do, so this script makes sense during execution
# And abort on any error
set -ex
set -x
# Abort on any error
set -e
# prepare use (only from top level directory)
export PATH="$PATH:$(pwd -P)/bin"

View File

@ -23,10 +23,8 @@
#
. cdist-config
if [ $# -ne 2 ]; then
__cdist_usage "<target host> <outdir>"
fi
[ $# -eq 2 ] || __cdist_usage "<target host> <outdir>"
set -e
export __cdist_target_host="$1"; shift
export __cdist_output_dir="$1"; shift

View File

@ -23,19 +23,15 @@
#
. cdist-config
if [ $# -ne 3 ]; then
__cdist_usage "<target host> <manifest> <outdir>"
fi
set -aeu
[ $# -eq 3 ] || __cdist_usage "<target host> <manifest> <outdir>"
set -u
export __cdist_target_host="$1"; shift
export __cdist_manifest="$1"; shift
export __cdist_output_dir="$1"; shift
# Ensure binaries exist and are up-to-date
cdist-build-bin
cdist-build-bin || __cdist_exit_err "Failed to build support binaries"
# prepend our path, so all cdist tools come before other tools
PATH="${__cdist_cache_bin}:$PATH"
@ -50,7 +46,12 @@ mkdir -p "${__cdist_output_dir}"
# Catch errors ourselves now
set +e
"${__cdist_manifest}"; ret=$?
# Ensure manifest fails if any error exists - FIXME: redundant, cdist-object-codegen
(
set -e
. "${__cdist_manifest}"
); ret=$?
if [ "$ret" -ne 0 ]; then
__cdist_exit_err "Error: ${__cdist_manifest} exited non-zero."
fi

View File

@ -56,7 +56,12 @@ eof
# Catch errors ourself now
set +e
"$gencode"; ret=$?
(
# Ensure manifest fails if something within manifest fails
# And not all manifests need to include set -e themselves
set -e
. "$gencode"
); ret=$?
else
ret=0

View File

@ -25,12 +25,15 @@
. cdist-config
set -e
pwd -P >&2
ls >&2
type="$(cat type)"
mode="$(cat mode)"
path="$(cat path)"
case "$type" in
case "$type" in
directory)
echo mkdir \"$path\"
;;