From ded30adf655f991d4edbb0ab3d170a8848036c6b Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Fri, 21 Sep 2012 15:42:07 +0300 Subject: [PATCH] Add IMAGE_DEBUG variable if this is set, then snf-image will run in debug mode. --- snf-image-host/common.sh.in | 1 + snf-image-host/create | 7 +++++++ snf-image-host/defaults | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/snf-image-host/common.sh.in b/snf-image-host/common.sh.in index 768a448..e78756c 100644 --- a/snf-image-host/common.sh.in +++ b/snf-image-host/common.sh.in @@ -372,6 +372,7 @@ fi : ${VARIANTS_DIR:="@sysconfdir@/ganeti/snf-image/variants"} : ${IMAGE_DIR:="@localstatedir@/lib/snf-image"} +: ${IMAGE_DEBUG:="no"} : ${HELPER_DIR:="@HELPER_DIR@"} : ${HELPER_IMG:="@HELPER_IMG@"} : ${HELPER_KERNEL:="@HELPER_KERNEL@"} diff --git a/snf-image-host/create b/snf-image-host/create index 00eb811..dad9fd0 100755 --- a/snf-image-host/create +++ b/snf-image-host/create @@ -24,6 +24,13 @@ set -o pipefail ganeti_os_main +if [ "$IMAGE_DEBUG" = "yes" ]; then + PS4='$(date "+%s.%N ($LINENO) + ")' + set -x +elif [ "$IMAGE_DEBUG" != "no" ]; then + echo "Warning: Unsupported IMAGE_DEBUG value: \`$IMAGE_DEBUG'" +fi + # Save stderr to a file stderr=$(mktemp) add_cleanup rm "$stderr" diff --git a/snf-image-host/defaults b/snf-image-host/defaults index ad3d967..6cc9a83 100644 --- a/snf-image-host/defaults +++ b/snf-image-host/defaults @@ -10,7 +10,7 @@ # IMAGE_DIR="/var/lib/snf-image" # IMAGE_DEBUG: turn on debugging output for the scripts -# IMAGE_DEBUG=0 +# IMAGE_DEBUG=no # HELPER_DIR: Directory hosting the helper files # HELPER_DIR="/var/lib/snf-image/helper/" -- 1.7.10.4