From a78097bf3fcbea81fc00cab10a76c709d2d3a1c2 Mon Sep 17 00:00:00 2001
From: "John L. Villalovos" <john.l.villalovos@intel.com>
Date: Mon, 7 Nov 2016 12:03:59 -0800
Subject: [PATCH] Add PS4 for better logfile information of devstack runs

The scripts
    tools/ironic/scripts/cleanup-node.sh
    tools/ironic/scripts/create-node.sh
    tools/ironic/scripts/setup-network.sh

are executed by sudo and the PS4 value disappears during sudo. Add a
PS4 value so that we get better logs during their execution.

PS4 is used to prefix the tracing output when using:
    'set -x' or 'set -o xtrace'

From the bash manpage:
PS4     The  value  of this parameter is expanded as with PS1 and the
        value is printed before each command bash displays during an
        execution trace.  The first character of PS4 is replicated
        multiple times, as necessary, to indicate multiple levels of
        indirection.  The default is ``+ ''.

Change-Id: If06f079bed16d9c84569594aa64259bf06f91a1e
---
 devstack/tools/ironic/scripts/cleanup-node.sh  | 3 +++
 devstack/tools/ironic/scripts/create-node.sh   | 3 +++
 devstack/tools/ironic/scripts/setup-network.sh | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/devstack/tools/ironic/scripts/cleanup-node.sh b/devstack/tools/ironic/scripts/cleanup-node.sh
index 0fa9e25bbb..ac837a2b44 100755
--- a/devstack/tools/ironic/scripts/cleanup-node.sh
+++ b/devstack/tools/ironic/scripts/cleanup-node.sh
@@ -7,6 +7,9 @@
 
 set -exu
 
+# Make tracing more educational
+export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}:   '
+
 LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
 LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
 
diff --git a/devstack/tools/ironic/scripts/create-node.sh b/devstack/tools/ironic/scripts/create-node.sh
index 8c0229f0c1..e072b07323 100755
--- a/devstack/tools/ironic/scripts/create-node.sh
+++ b/devstack/tools/ironic/scripts/create-node.sh
@@ -6,6 +6,9 @@
 
 set -ex
 
+# Make tracing more educational
+export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}:   '
+
 # Keep track of the DevStack directory
 TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
 
diff --git a/devstack/tools/ironic/scripts/setup-network.sh b/devstack/tools/ironic/scripts/setup-network.sh
index 3eb6ed80bf..e2dfc26662 100755
--- a/devstack/tools/ironic/scripts/setup-network.sh
+++ b/devstack/tools/ironic/scripts/setup-network.sh
@@ -7,6 +7,9 @@
 
 set -exu
 
+# Make tracing more educational
+export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}:   '
+
 LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
 
 # Keep track of the DevStack directory