Fix unbound variable error in scripts/collect-test-info.sh

The scripts/collect-test-info.sh script is executed with '-u' which means
that unset variables will trigger an error like the following one:

scripts/collect-test-info.sh: line 16: TEST_VM_NODE_NAMES: unbound variable

We handle this case by simply setting an alternative value when the variable is set
in order to treat the unset variable gracefully.

Change-Id: Ic4b450fe8654568e30eacb00aeff128d675ed616
This commit is contained in:
Markos Chandras 2016-09-07 16:33:44 +01:00
parent 558c5c7ee3
commit 7fb32dd599

View File

@ -13,7 +13,7 @@ LOG_LOCATION="${WORKSPACE:-${SCRIPT_HOME}/..}/logs"
echo "Making logs directory and collecting logs." echo "Making logs directory and collecting logs."
[ -d ${LOG_LOCATION} ] || mkdir -p ${LOG_LOCATION} [ -d ${LOG_LOCATION} ] || mkdir -p ${LOG_LOCATION}
if [ -z "${TEST_VM_NODE_NAMES}" ]; then if [ -z "${TEST_VM_NODE_NAMES+x}" ]; then
sudo cp /var/log/libvirt/baremetal_logs/testvm[[:digit:]]_console.log ${LOG_LOCATION} sudo cp /var/log/libvirt/baremetal_logs/testvm[[:digit:]]_console.log ${LOG_LOCATION}
sudo chown $USER ${LOG_LOCATION}/testvm[[:digit:]]_console.log sudo chown $USER ${LOG_LOCATION}/testvm[[:digit:]]_console.log
sudo chmod o+r ${LOG_LOCATION}/testvm[[:digit:]]_console.log sudo chmod o+r ${LOG_LOCATION}/testvm[[:digit:]]_console.log