From d467b8ea142756e052c2c28ed0c6d6227a493ce2 Mon Sep 17 00:00:00 2001 From: Odin Ugedal Date: Wed, 23 Oct 2019 21:09:47 +0200 Subject: [PATCH] Fix shellcheck failures SC2128 --- hack/.shellcheck_failures | 9 --------- test/images/pets/redis-installer/on-start.sh | 8 ++++---- test/images/pets/zookeeper-installer/on-start.sh | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 1f0086d1628..82638a92176 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -10,12 +10,3 @@ ./cluster/gce/util.sh ./cluster/log-dump/log-dump.sh ./cluster/pre-existing/util.sh -./test/cmd/apply.sh -./test/cmd/apps.sh -./test/cmd/core.sh -./test/cmd/crd.sh -./test/cmd/create.sh -./test/cmd/generic-resources.sh -./test/cmd/save-config.sh -./test/images/pets/redis-installer/on-start.sh -./test/images/pets/zookeeper-installer/on-start.sh diff --git a/test/images/pets/redis-installer/on-start.sh b/test/images/pets/redis-installer/on-start.sh index cc8f8084abb..77a50625eb0 100755 --- a/test/images/pets/redis-installer/on-start.sh +++ b/test/images/pets/redis-installer/on-start.sh @@ -25,11 +25,11 @@ PORT=6379 # Ping everyone but ourself to see if there's a master. Only one pet starts at # a time, so if we don't see a master we can assume the position is ours. while read -ra LINE; do - if [[ "${LINE}" == *"${HOSTNAME}"* ]]; then - sed -i -e "s|^bind.*$|bind ${LINE}|" ${CFG} - elif [ "$(/opt/redis/redis-cli -h "${LINE}" info | grep role | sed 's,\r$,,')" = "role:master" ]; then + if [[ "${LINE[0]}" == *"${HOSTNAME}"* ]]; then + sed -i -e "s|^bind.*$|bind ${LINE[0]}|" ${CFG} + elif [ "$(/opt/redis/redis-cli -h "${LINE[0]}" info | grep role | sed 's,\r$,,')" = "role:master" ]; then # TODO: More restrictive regex? - sed -i -e "s|^# slaveof.*$|slaveof ${LINE} ${PORT}|" ${CFG} + sed -i -e "s|^# slaveof.*$|slaveof ${LINE[0]} ${PORT}|" ${CFG} fi done diff --git a/test/images/pets/zookeeper-installer/on-start.sh b/test/images/pets/zookeeper-installer/on-start.sh index 92eadee009b..b478a5a1f5e 100755 --- a/test/images/pets/zookeeper-installer/on-start.sh +++ b/test/images/pets/zookeeper-installer/on-start.sh @@ -36,7 +36,7 @@ MY_ID_FILE=/tmp/zookeeper/myid HOSTNAME=$(hostname) while read -ra LINE; do - PEERS=("${PEERS[@]}" "$LINE") + PEERS=("${PEERS[@]}" "${LINE[0]}") done # Don't add the first member as an observer