From 9fe53aa4bb82b771ab61290d8102781edf084012 Mon Sep 17 00:00:00 2001 From: davidplunkett Date: Fri, 21 Sep 2018 19:39:33 +0000 Subject: [PATCH] improved variable checking for install_server_os Change-Id: Idc9fe047b3cf38820c098b278e88c620e257c7d9 Signed-off-by: davidplunkett --- install_server_os.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install_server_os.sh b/install_server_os.sh index e6962ab..b15062d 100755 --- a/install_server_os.sh +++ b/install_server_os.sh @@ -88,11 +88,15 @@ if [ -n "$RCFILE" ] && [ -f "$RCFILE" ]; then source $RCFILE fi -if [ -z "$SRV_NAME" ] || [ -z "$SRV_OOB_IP" ] || [ -z "$SRV_OOB_USR" ] || [ -z "$SRV_OOB_PWD" ] || [ -z "$SRV_IPXE_INF" ] ; then - echo "ERROR: Invalid or missing variables in rcfile [$RCFILE]" - echo "usage: ./install_regionserver.sh [--rc settingsfile] [--no-confirm] [--no-apply-hw] [--help]" - exit 1 -fi +# CHECK A FEW REQUIRED VARIABLES - BUT NOT ALL +CHECKLIST="SRV_NAME SRV_OOB_IP SRV_OOB_USR SRV_OOB_PWD SRV_IPXE_INF BUILD_WEBIP BUILD_WEBPORT" +for VAR in $CHECKLIST; do + if [ -z "${!VAR}" ] ; then + echo "ERROR: Invalid or missing variable [$VAR] = [${!VAR}] in rcfile [$RCFILE]" + echo "usage: ./install_regionserver.sh [--rc settingsfile] [--no-confirm] [--no-apply-hw] [--help]" + exit 1 + fi +done ## FIND BUILD_WEBIP IF NOT PROVIDED if [ -z "$BUILD_WEBIP" ]; then -- 2.16.6