Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some linter warnings, part 2 #202

Merged
merged 7 commits into from
Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions kafka-init/wait-for.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Use this script to test if a given TCP host/port are available
# https://github.com/vishnubob/wait-for-it/blob/master/wait-for-it.sh

cmdname=$(basename $0)
cmdname=$(basename "$0")

echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }

Expand Down Expand Up @@ -34,10 +34,10 @@ wait_for()
while :
do
if [[ $ISBUSY -eq 1 ]]; then
nc -z $HOST $PORT
nc -z "$HOST" "$PORT"
result=$?
else
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
(echo > /dev/tcp/"$HOST"/"$PORT") >/dev/null 2>&1
result=$?
fi
if [[ $result -eq 0 ]]; then
Expand All @@ -54,9 +54,9 @@ wait_for_wrapper()
{
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $QUIET -eq 1 ]]; then
timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
timeout "$BUSYTIMEFLAG" "$TIMEOUT" $0 --quiet" --child --host="$HOST" --port="$PORT" --timeout="$TIMEOUT" &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erroneous double quote after --quiet

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

else
timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
timeout "$BUSYTIMEFLAG" "$TIMEOUT" $0 --child --host="$HOST" --port="$PORT" --timeout="$TIMEOUT" &
fi
PID=$!
trap "kill -INT -$PID" INT
Expand Down Expand Up @@ -172,7 +172,7 @@ if [[ $CLI != "" ]]; then
echoerr "$cmdname: strict mode, refusing to execute subprocess"
exit $RESULT
fi
exec $CLI
exec "$CLI"
else
exit $RESULT
exit "$RESULT"
fi
14 changes: 7 additions & 7 deletions kafka/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ export STATE_CHANGE_LOG_LEVEL=${STATE_CHANGE_LOG_LEVEL:-"INFO"}
export AUTHORIZER_LOG_LEVEL=${AUTHORIZER_LOG_LEVEL:-"WARN"}
GC_LOG_ENABLED=${GC_LOG_ENABLED:-"False"}

first_zk=$(echo $ZOOKEEPER_CONNECTION_STRING | cut -d, -f1)
zk_host=$(echo $first_zk | cut -d\: -f1)
zk_port=$(echo $first_zk | cut -d\: -f2)
first_zk=$(echo "$ZOOKEEPER_CONNECTION_STRING" | cut -d, -f1)
zk_host=$(echo "$first_zk" | cut -d\: -f1)
zk_port=$(echo "$first_zk" | cut -d\: -f2)

# wait for zookeeper to become available
if [ "$ZOOKEEPER_WAIT" = "true" ]; then
success="false"
for i in $(seq $ZOOKEEPER_WAIT_RETRIES); do
ok=$(echo ruok | nc $zk_host $zk_port -w $ZOOKEEPER_WAIT_TIMEOUT)
for i in $(seq "$ZOOKEEPER_WAIT_RETRIES"); do
ok=$(echo ruok | nc "$zk_host" "$zk_port" -w "$ZOOKEEPER_WAIT_TIMEOUT")
if [ $? -eq 0 -a "$ok" = "imok" ]; then
success="true"
break
else
echo "Connect attempt $i of $ZOOKEEPER_WAIT_RETRIES failed, retrying..."
sleep $ZOOKEEPER_WAIT_DELAY
sleep "$ZOOKEEPER_WAIT_DELAY"
fi
done

Expand Down Expand Up @@ -69,7 +69,7 @@ for f in $CONFIG_TEMPLATES/*.properties.j2; do
done

if [ -z "$KAFKA_HEAP_OPTS" ]; then
max_heap=$(python /heap.py $KAFKA_MAX_HEAP_MB)
max_heap=$(python /heap.py "$KAFKA_MAX_HEAP_MB")
KAFKA_HEAP_OPTS="-Xmx${max_heap} -Xms${max_heap}"
export KAFKA_HEAP_OPTS
fi
Expand Down
18 changes: 9 additions & 9 deletions keystone/keystone-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ fi
if [[ -e /db-init ]]; then
echo "Creating bootstrap credentials..."
keystone-manage bootstrap \
--bootstrap-password $admin_password \
--bootstrap-username $admin_username \
--bootstrap-project-name $admin_project \
--bootstrap-role-name $admin_role \
--bootstrap-service-name $admin_service \
--bootstrap-region-id $admin_region \
--bootstrap-admin-url $admin_url \
--bootstrap-public-url $public_url \
--bootstrap-internal-url $internal_url
--bootstrap-password "$admin_password" \
--bootstrap-username "$admin_username" \
--bootstrap-project-name "$admin_project" \
--bootstrap-role-name "$admin_role" \
--bootstrap-service-name "$admin_service" \
--bootstrap-region-id "$admin_region" \
--bootstrap-admin-url "$admin_url" \
--bootstrap-public-url "$public_url" \
--bootstrap-internal-url "$internal_url"

sleep 5

Expand Down
4 changes: 2 additions & 2 deletions keystone/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [[ "$KEYSTONE_DATABASE_BACKEND" = "mysql" ]]; then

echo "Waiting for mysql to become available..."
success="false"
for i in $(seq $retries); do
for i in $(seq "$retries"); do
mysqladmin status \
--host="$mysql_host" \
--user="$mysql_user" \
Expand Down Expand Up @@ -40,7 +40,7 @@ if [[ "$KEYSTONE_DATABASE_BACKEND" = "mysql" ]]; then
/etc/keystone/keystone.conf

# check to see if table exists already and skip init if so
mysql -h ${mysql_host} -u ${mysql_user} -p${mysql_pass} -e "desc ${mysql_db}.migrate_version" &> /dev/null
mysql -h "${mysql_host}" -u "${mysql_user}" -p"${mysql_pass}" -e "desc ${mysql_db}.migrate_version" &> /dev/null
if [[ $? -eq 0 ]]; then
echo "MySQL database has already been initialized, skipping..."
else
Expand Down
4 changes: 2 additions & 2 deletions kibana/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

python /template.py /kibana.yml.j2 /opt/kibana/config/kibana.yml

if [ $MONASCA_PLUGIN_ENABLED == True ]; then
/wait-for.sh $KEYSTONE_URI -- kibana
if [ "$MONASCA_PLUGIN_ENABLED" == True ]; then
/wait-for.sh "$KEYSTONE_URI" -- kibana
else
kibana
fi
16 changes: 8 additions & 8 deletions kibana/wait-for.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available

cmdname=$(basename $0)
cmdname=$(basename "$0")

echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }

Expand Down Expand Up @@ -33,10 +33,10 @@ wait_for()
while :
do
if [[ $ISBUSY -eq 1 ]]; then
nc -z $HOST $PORT
nc -z "$HOST" "$PORT"
result=$?
else
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
(echo > /dev/tcp/"$HOST"/"$PORT") >/dev/null 2>&1
result=$?
fi
if [[ $result -eq 0 ]]; then
Expand All @@ -53,9 +53,9 @@ wait_for_wrapper()
{
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $QUIET -eq 1 ]]; then
timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
timeout "$BUSYTIMEFLAG" "$TIMEOUT" "$0" --quiet --child --host="$HOST" --port="$PORT" --timeout="$TIMEOUT" &
else
timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
timeout "$BUSYTIMEFLAG" "$TIMEOUT" "$0" --child --host="$HOST" --port="$PORT" --timeout="$TIMEOUT" &
fi
PID=$!
trap "kill -INT -$PID" INT
Expand Down Expand Up @@ -142,7 +142,7 @@ CHILD=${CHILD:-0}
QUIET=${QUIET:-0}

# check to see if timeout is from busybox?
TIMEOUT_PATH=$(realpath $(which timeout))
TIMEOUT_PATH=$(realpath "$(which timeout)")
if [[ $TIMEOUT_PATH =~ "busybox" ]]; then
ISBUSY=1
BUSYTIMEFLAG="-t"
Expand Down Expand Up @@ -170,7 +170,7 @@ if [[ $CLI != "" ]]; then
echoerr "$cmdname: strict mode, refusing to execute subprocess"
exit $RESULT
fi
exec $CLI
exec "$CLI"
else
exit $RESULT
exit "$RESULT"
fi