From c08bfd220589100765566ab014cac454c387acbf Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 18 May 2015 11:16:12 +0100 Subject: [PATCH] always quote $@ --- test/500_weave_multi_cidr_test.sh | 6 +++--- test/config.sh | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/500_weave_multi_cidr_test.sh b/test/500_weave_multi_cidr_test.sh index 6b882bcf..4e3edf32 100755 --- a/test/500_weave_multi_cidr_test.sh +++ b/test/500_weave_multi_cidr_test.sh @@ -8,7 +8,7 @@ NAME=multicidr.weave.local assert_container_cidrs() { HOST=$1; shift CID=$1; shift - CIDRS=$@ + CIDRS="$@" # Assert container has attached CIDRs assert_raises "weave_on $HOST ps | grep \"^$CID [^ ]* $CIDRS$\"" @@ -24,7 +24,7 @@ assert_zone_records() { assert "weave_on $HOST status | grep \"^$CID\" | wc -l" $# # Assert correct records exist - for IP in $@; do + for IP; do assert_raises "weave_on $HOST status | grep \"^$CID $IP $FQDN$\"" done } @@ -33,7 +33,7 @@ assert_zone_records() { assert_bridge_cidrs() { HOST=$1; shift DEV=$1; shift - CIDRS=$@ + CIDRS="$@" BRIDGE_CIDRS=$($SSH $HOST ip addr show dev $DEV | grep -o 'inet .*' | cut -d ' ' -f 2) diff --git a/test/config.sh b/test/config.sh index 547bedd7..3983c826 100644 --- a/test/config.sh +++ b/test/config.sh @@ -34,7 +34,7 @@ PING="ping -nq -W 1 -c 1" remote() { rem=$1 shift 1 - $@ > >(while read line; do echo -e "\e[0;34m$rem>\e[0m $line"; done) + "$@" > >(while read line; do echo -e "\e[0;34m$rem>\e[0m $line"; done) } colourise() { @@ -66,40 +66,40 @@ run_on() { host=$1 shift 1 greyly echo "Running on $host: $@" >&2 - remote $host $SSH $host $@ + remote $host $SSH $host "$@" } docker_on() { host=$1 shift 1 greyly echo "Docker on $host: $@" >&2 - docker -H tcp://$host:2375 $@ + docker -H tcp://$host:2375 "$@" } weave_on() { host=$1 shift 1 greyly echo "Weave on $host: $@" >&2 - DOCKER_HOST=tcp://$host:2375 $WEAVE $@ + DOCKER_HOST=tcp://$host:2375 $WEAVE "$@" } exec_on() { host=$1 container=$2 shift 2 - docker -H tcp://$host:2375 exec $container $@ + docker -H tcp://$host:2375 exec $container "$@" } start_container() { host=$1 shift 1 - weave_on $host run $@ -t gliderlabs/alpine /bin/sh + weave_on $host run "$@" -t gliderlabs/alpine /bin/sh } start_container_with_dns() { host=$1 shift 1 - weave_on $host run --with-dns $@ -t aanand/docker-dnsutils /bin/sh + weave_on $host run --with-dns "$@" -t aanand/docker-dnsutils /bin/sh } container_ip() { @@ -119,7 +119,7 @@ start_suite() { [ -n "$containers" ] && docker_on $host rm -f $containers >/dev/null 2>&1 weave_on $host reset 2>/dev/null done - whitely echo $@ + whitely echo "$@" } end_suite() {