Fix shellcheck failures SC2128

This commit is contained in:
Odin Ugedal 2019-10-23 21:09:47 +02:00
parent cce1f32ea5
commit d467b8ea14
No known key found for this signature in database
GPG Key ID: AFF9C8242CF7A7AF
3 changed files with 5 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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