Skip to content

Commit b046f53

Browse files
committed
Make detection of master presence more robust
1 parent f7cb216 commit b046f53

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kube-linode.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ unset API_KEY
4242
unset USERNAME
4343
unset NO_OF_WORKERS
4444
unset REBOOT_STRATEGY
45+
unset WORKER_IDS
4546

4647
stty -echo
4748
tput civis
@@ -113,7 +114,7 @@ fi
113114

114115
if [ "$1" == "destroy" ]; then
115116
spinner "Retrieving master linode (if any)" get_master_id MASTER_ID
116-
if [ -z "$MASTER_ID" ]; then
117+
if ! [[ $MASTER_ID =~ ^[0-9]+$ ]] 2>/dev/null; then
117118
tput el
118119
echo "${red}No master node found! Cluster is likely to have been deleted.${normal}"
119120
else
@@ -160,7 +161,7 @@ if [ "$1" == "destroy" ]; then
160161
elif [ "$1" == "create" ]; then
161162
spinner "Retrieving master linode (if any)" get_master_id MASTER_ID
162163

163-
if ! [[ $MASTER_ID =~ ^-?[0-9]+$ ]] 2>/dev/null; then
164+
if ! [[ $MASTER_ID =~ ^[0-9]+$ ]] 2>/dev/null; then
164165
spinner "Retrieving list of workers" list_worker_ids WORKER_IDS
165166
for WORKER_ID in $WORKER_IDS; do
166167
spinner "${CYAN}[$WORKER_ID]${NORMAL} Deleting worker (since certs are now invalid)"\

0 commit comments

Comments
 (0)