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
This commit is contained in:
parent
ec24e3ed7a
commit
0550d6900c
@ -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…
Reference in New Issue
Block a user