From d0e19aac90f68382763a453b0ea5e22f06dcceff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sat, 16 Mar 2019 16:47:28 +0100 Subject: [PATCH] Update cluster-withdraw --- cluster-withdraw | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cluster-withdraw b/cluster-withdraw index d06cd29..d742c8a 100644 --- a/cluster-withdraw +++ b/cluster-withdraw @@ -17,7 +17,6 @@ WORKER_LIST="worker.list" #FIXME Write usage message function usage { cat << EOF - EOF } @@ -28,15 +27,21 @@ function echo_err { } -## Check files from parameters +## Check file from parameters if [ ! -f $WORKER_LIST ]; then echo_err "Worker list file ($WORKER_LIST) not exists." exit 1 - else if [ ! -s $WORKER_LIST ]; then - echo_err "Worker list file ($WORKER_LIST) is empty." - fi fi +## Check the file contents +if [ ! -s $WORKER_LIST ]; then + echo_err "Worker list file ($WORKER_LIST) is empty." + exit 1 +fi + +## Create WORKER array from file +readarray WORKER < $WORKER_LIST + # Reset Master node ./withdraw/node_reset.sh rm -rf ~/.kube @@ -55,4 +60,4 @@ for LINE in $(cat $WORKER_LIST | grep -vE "^#"); do # ssh $WORKERNAME -o "StrictHostKeyChecking no" "bash -s" < ./deploy/docker_registry_setup.sh $IP:5000 echo "[worker:$WORKERNAME] Eviction is completed." -done \ No newline at end of file +done