From 855ab0d850ef5a7d4ae00708f249f3b0146be470 Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Tue, 3 Apr 2018 14:33:09 +1000
Subject: [PATCH] Restore tracing on exit points of
 block_device_create_config_file

We exit in several places and don't restore tracing.  Previously in
nodepool we relied on the default fallback, which did restore the
tracing.  Since we now use the MBR config file, we take the different
exit path without it and the debugging output is incomplete.

Change-Id: I586fc95517926025705ce376ec5c4aaf4122773f
---
 diskimage_builder/lib/common-functions | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/diskimage_builder/lib/common-functions b/diskimage_builder/lib/common-functions
index 5088f86b1..407852dc7 100644
--- a/diskimage_builder/lib/common-functions
+++ b/diskimage_builder/lib/common-functions
@@ -437,11 +437,13 @@ function block_device_create_config_file {
     if [[ ${DIB_BLOCK_DEVICE_CONFIG:-} == file://* ]]; then
         cp $(echo ${DIB_BLOCK_DEVICE_CONFIG} | cut -c 8-) ${config_yaml}
         echo "Using file-based block-device config: ${DIB_BLOCK_DEVICE_CONFIG}"
+        $xtrace
         return
     fi
     if [ -n "${DIB_BLOCK_DEVICE_CONFIG:-}" ]; then
         printf "%s" "${DIB_BLOCK_DEVICE_CONFIG}" >${config_yaml}
         echo "User specified block-device config from DIB_BLOCK_DEVICE_CONFIG"
+        $xtrace
         return
     fi
 
@@ -463,12 +465,14 @@ function block_device_create_config_file {
         if [ -e ${cfg} ]; then
             cp ${cfg} ${config_yaml}
             echo "Using block-device config: ${cfg}"
+            $xtrace
             return
         else
             cfg=${image_elements[$i]}/block-device-default.yaml
             if [ -e ${cfg} ]; then
                 cp ${cfg} ${config_yaml}
                 echo "Using block-device config: ${cfg}"
+                $xtrace
                 return
             fi
         fi