Browse code

Set PS4 in stack.sh to provide additional debug info

Add:
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'

To stack.sh to provide additional debug info. This will show the
filename, line number, function name, and the content of the line.

An example output line:
+++(/opt/stack/old/devstack/functions-common:675): get_field(): local data field

Info on this PS4 variable found at:
http://wiki.bash-hackers.org/scripting/debuggingtips

Change-Id: I272df6c79f6ff7afa8f102da24706558d9169eda

John L. Villalovos authored on 2016/01/22 11:35:43
Showing 1 changed files
... ...
@@ -23,6 +23,7 @@
23 23
 # Print the commands being run so that we can see the command that triggers
24 24
 # an error.  It is also useful for following along as the install occurs.
25 25
 set -o xtrace
26
+export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
26 27
 
27 28
 # Make sure custom grep options don't get in the way
28 29
 unset GREP_OPTIONS
... ...
@@ -238,6 +239,7 @@ echo "$STACK_USER ALL=(root) NOPASSWD:ALL" >$TEMPFILE
238 238
 # see them by forcing ``PATH``
239 239
 echo "Defaults:$STACK_USER secure_path=/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin" >> $TEMPFILE
240 240
 echo "Defaults:$STACK_USER !requiretty" >> $TEMPFILE
241
+echo "Defaults env_keep += PS4" >> $TEMPFILE
241 242
 chmod 0440 $TEMPFILE
242 243
 sudo chown root:root $TEMPFILE
243 244
 sudo mv $TEMPFILE /etc/sudoers.d/50_stack_sh