Fix various linter issues

Found via shellcheck.
This commit is contained in:
Iago López Galeiras
2017-01-09 16:20:24 +01:00
parent ec0b6dd8d0
commit 43d9f38c5e
34 changed files with 268 additions and 227 deletions

View File

@@ -2,4 +2,4 @@
set -e
./in_parallel.sh "make RM=" $(find . -maxdepth 2 -name *.go -printf "%h\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')
./in_parallel.sh "make RM=" "$(find . -maxdepth 2 -name "./*.go" -printf "%h\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')"

View File

@@ -9,6 +9,7 @@ readonly addr=$1
readonly max_dialer=${2:-50}
dialer=()
# shellcheck disable=SC2154
trap 'echo -n "stopping ... "; for c in "${dialer[@]}"; do docker rm -f "$c" >/dev/null; done; echo "done"' EXIT
while true; do

View File

@@ -4,11 +4,11 @@ set -ex
readonly ARG="$1"
if ! $(weave status 1>/dev/null 2>&1); then
if ! weave status 1>/dev/null 2>&1; then
WEAVE_NO_PLUGIN=y weave launch
fi
eval $(weave env)
eval "$(weave env)"
start_container() {
local IMAGE=$2
@@ -17,12 +17,12 @@ start_container() {
shift 3
local HOSTNAME=$BASENAME.weave.local
for i in $(seq $REPLICAS); do
if docker inspect $BASENAME$i >/dev/null 2>&1; then
docker rm -f $BASENAME$i
for i in $(seq "$REPLICAS"); do
if docker inspect "$BASENAME""$i" >/dev/null 2>&1; then
docker rm -f "$BASENAME""$i"
fi
if [ "$ARG" != "-rm" ]; then
docker run -d --name=$BASENAME$i --hostname=$HOSTNAME $@ $IMAGE
docker run -d --name="$BASENAME""$i" --hostname="$HOSTNAME" "$@" "$IMAGE"
fi
done
}
@@ -33,6 +33,6 @@ start_container 1 redis redis
start_container 1 tomwilkie/qotd qotd
start_container 1 tomwilkie/echo echo
start_container 2 tomwilkie/app app
start_container 2 tomwilkie/frontend frontend --add-host=dns.weave.local:$(weave docker-bridge-ip)
start_container 2 tomwilkie/frontend frontend --add-host=dns.weave.local:"$(weave docker-bridge-ip)"
start_container 1 tomwilkie/client client

View File

@@ -4,11 +4,11 @@ set -ex
readonly ARG="$1"
if ! $(weave status 1>/dev/null 2>&1); then
if ! weave status 1>/dev/null 2>&1; then
WEAVE_NO_PLUGIN=y weave launch
fi
eval $(weave env)
eval "$(weave env)"
start_container() {
local replicas=$1
@@ -30,14 +30,14 @@ start_container() {
;;
esac
done
local container_args="$@"
local container_args="$*"
for i in $(seq ${replicas}); do
if docker inspect ${basename}${i} >/dev/null 2>&1; then
docker rm -f ${basename}${i}
for i in $(seq "${replicas}"); do
if docker inspect "${basename}""${i}" >/dev/null 2>&1; then
docker rm -f "${basename}""${i}"
fi
docker run -d -e CHECKPOINT_DISABLE --name=${basename}${i} --hostname=${hostname} \
${docker_args} ${image} ${container_args}
docker run -d -e CHECKPOINT_DISABLE --name="${basename}""${i}" --hostname="${hostname}" \
"${docker_args}" "${image}" "${container_args}"
done
}

View File

@@ -19,14 +19,14 @@ shift 1
INPUTS="$*"
SCHED_NAME=parallel-$CIRCLE_PROJECT_USERNAME-$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM
INPUTS=$(echo $INPUTS | "../tools/sched" sched $SCHED_NAME $CIRCLE_NODE_TOTAL $CIRCLE_NODE_INDEX)
INPUTS=$(echo "$INPUTS" | "../tools/sched" sched "$SCHED_NAME" "$CIRCLE_NODE_TOTAL" "$CIRCLE_NODE_INDEX")
echo Doing $INPUTS
echo Doing "$INPUTS"
for INPUT in $INPUTS; do
START=$(date +%s)
$COMMAND $INPUT
RUNTIME=$(( $(date +%s) - $START ))
"$COMMAND" "$INPUT"
RUNTIME=$(( $(date +%s) - START ))
"../tools/sched" time $INPUT $RUNTIME
"../tools/sched" time "$INPUT" "$RUNTIME"
done