From c3bf34bf3d9a59c8467f94e5830b6b2711f1b753 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Sep 2011 10:07:04 +0200 Subject: [PATCH] add support for __cdist_debug={0,1,2} Signed-off-by: Nico Schottelius --- bin/cdist-config | 12 ++++++++++-- core/__cdist_echo | 4 +--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index bf3f5b24..b15d1f3e 100644 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -21,8 +21,16 @@ __cdist_version="1.8.0" -# Enable debugging -[ "$__cdist_debug" ] && set -x +# +# Enable debugging: +# +# __cdist_debug unset -> no debug +# __cdist_debug = 1 -> debug via __cdist_echo +# __cdist_debug = 2 -> debug via set -x +# + +: ${__cdist_debug:=0} +[ "$__cdist_debug" = 2 ] && set -x # Fail if something bogus is going on set -u diff --git a/core/__cdist_echo b/core/__cdist_echo index 2fcc93f0..37d24dd6 100755 --- a/core/__cdist_echo +++ b/core/__cdist_echo @@ -35,11 +35,9 @@ __cdist_echo() case "$__cdist_echo_type" in debug) - set +u - if [ "$__cdist_debug" ]; then + if [ "$__cdist_debug" = 1 ]; then echo $__cdist_echo_prefix "Debug: $@" fi - set -u ;; info) echo $__cdist_echo_prefix "$@"