forked from ungleich-public/cdist
introduce and use __cdist_exec_fail_on_error
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
da8abcb770
commit
5dcb719844
3 changed files with 5 additions and 29 deletions
|
@ -181,7 +181,8 @@ __cdist_object_source()
|
|||
|
||||
__cdist_exec_fail_on_error()
|
||||
{
|
||||
sh -e "$1"
|
||||
sh -e "$@"
|
||||
[ "$?" -eq 0 ] || __cdist_exit_err "Error: $1 exited non-zero."
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,17 +41,6 @@ if [ ! -x "${__cdist_manifest}" ]; then
|
|||
__cdist_exit_err "${__cdist_manifest} needs to be executable."
|
||||
fi
|
||||
|
||||
mkdir -p "${__cdist_output_dir}"
|
||||
mkdir -p "${__cdist_output_dir}" || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}"
|
||||
|
||||
# Catch errors ourselves now
|
||||
set +e
|
||||
|
||||
# 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
|
||||
__cdist_exec_fail_on_error "${__cdist_manifest}"
|
||||
|
|
|
@ -54,19 +54,5 @@ if [ -x "$gencode" ]; then
|
|||
|
||||
eof
|
||||
|
||||
# Catch errors ourself now
|
||||
set +e
|
||||
(
|
||||
# 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
|
||||
fi
|
||||
|
||||
if [ "$ret" -ne 0 ]; then
|
||||
__cdist_exit_err "Error: $gencode exited non-zero"
|
||||
__cdist_exec_fail_on_error "$gencode"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue