misleading source filename in error message
when ./stack.sh encounters error, the output may look like this:
[ERROR] ./stack.sh:698 nova-api did not start
The source filename is wrong. Actually, it should be like this:
[ERROR] /<path_of_devstack>/lib/nova:698 nova-api did not start
stack.sh uses bash as interpreter, which define "Shell Variables"
BASH_SOURCE:
An array variable whose members are the source filenames where
the corresponding shell function names in the FUNCNAME array
variable are defined. The shell function
${FUNCNAME[$i]} is defined in the file ${BASH_SOURCE[$i]}
and called from ${BASH_SOURCE[$i+1]}.
The function "err" is called by function "die" ( and "err_if_not_set",
and "err_if_not_set" is not used at all). ${BASH_SOURCE[2]} will
ignore the deepest two call entries, which corresponding to the shell
functions: "err" and "die".
In one sentence, this change will print the source filename where the
function is defined and exits via function "die".
Fixes bug #1207658
Change-Id: I2aa6642c5cf4cfe781afe278b3dec3e7cba277fa
This commit is contained in:
Reference in New Issue
Block a user