Browse Source

Fix unbound variable

If operator runs script without any variables it will fail as

scripts/run-local-test: line 26: $1: unbound variable

This patch adds usage function and check if script is run without
ROLE_NAME

Change-Id: I9137821c8396568be125ec686bad2534f9d433b2
changes/00/778800/4
Sergii Golovatiuk 1 year ago
parent
commit
0550d6900c
  1. 17
      scripts/run-local-test

17
scripts/run-local-test

@ -15,17 +15,26 @@
# under the License.
## Shell Opts ----------------------------------------------------------------
set -o pipefail
set -xeuo
## Functions -----------------------------------------------------------------
function usage {
echo "Usage: ROLE_NAME=ROLE_NAME ${0##*/} or ${0##*/} ROLE_NAME"
}
## Vars ----------------------------------------------------------------------
export PROJECT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/../"
if [ "${ROLE_NAME}x" = "x" -a "${1}x" = "x" ]; then
usage;
exit 2
fi
export ROLE_NAME="${ROLE_NAME:-$1}"
export TRIPLEO_JOB_ANSIBLE_ARGS=${TRIPLEO_JOB_ANSIBLE_ARGS:-""}
## Shell Opts ----------------------------------------------------------------
set -o pipefail
set -xeuo
## Main ----------------------------------------------------------------------
# Source distribution information

Loading…
Cancel
Save