always quote $@

This commit is contained in:
Matthias Radestock committed 2015-05-18 11:16:12 +01:00
1 parent 6dd6d9d6f0
commit c08bfd2205
2 files changed
+11 -11

No files matched your search

+3 -3
View File
@@ -8,7 +8,7 @@ NAME=multicidr.weave.local
assert_container_cidrs() { assert_container_cidrs() {
HOST=$1; shift HOST=$1; shift
CID=$1; shift CID=$1; shift
CIDRS=$@ CIDRS="$@"
# Assert container has attached CIDRs # Assert container has attached CIDRs
assert_raises "weave_on $HOST ps | grep \"^$CID [^ ]* $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 "weave_on $HOST status | grep \"^$CID\" | wc -l" $#
# Assert correct records exist # Assert correct records exist
for IP in $@; do for IP; do
assert_raises "weave_on $HOST status | grep \"^$CID $IP $FQDN$\"" assert_raises "weave_on $HOST status | grep \"^$CID $IP $FQDN$\""
done done
} }
@@ -33,7 +33,7 @@ assert_zone_records() {
assert_bridge_cidrs() { assert_bridge_cidrs() {
HOST=$1; shift HOST=$1; shift
DEV=$1; shift DEV=$1; shift
CIDRS=$@ CIDRS="$@"
BRIDGE_CIDRS=$($SSH $HOST ip addr show dev $DEV | grep -o 'inet .*' | cut -d ' ' -f 2) BRIDGE_CIDRS=$($SSH $HOST ip addr show dev $DEV | grep -o 'inet .*' | cut -d ' ' -f 2)
+8 -8
View File
@@ -34,7 +34,7 @@ PING="ping -nq -W 1 -c 1"
remote() { remote() {
rem=$1 rem=$1
shift 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() { colourise() {
@@ -66,40 +66,40 @@ run_on() {
host=$1 host=$1
shift 1 shift 1
greyly echo "Running on $host: $@" >&2 greyly echo "Running on $host: $@" >&2
remote $host $SSH $host $@ remote $host $SSH $host "$@"
} }
docker_on() { docker_on() {
host=$1 host=$1
shift 1 shift 1
greyly echo "Docker on $host: $@" >&2 greyly echo "Docker on $host: $@" >&2
docker -H tcp://$host:2375 $@ docker -H tcp://$host:2375 "$@"
} }
weave_on() { weave_on() {
host=$1 host=$1
shift 1 shift 1
greyly echo "Weave on $host: $@" >&2 greyly echo "Weave on $host: $@" >&2
DOCKER_HOST=tcp://$host:2375 $WEAVE $@ DOCKER_HOST=tcp://$host:2375 $WEAVE "$@"
} }
exec_on() { exec_on() {
host=$1 host=$1
container=$2 container=$2
shift 2 shift 2
docker -H tcp://$host:2375 exec $container $@ docker -H tcp://$host:2375 exec $container "$@"
} }
start_container() { start_container() {
host=$1 host=$1
shift 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() { start_container_with_dns() {
host=$1 host=$1
shift 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() { container_ip() {
@@ -119,7 +119,7 @@ start_suite() {
[ -n "$containers" ] && docker_on $host rm -f $containers >/dev/null 2>&1 [ -n "$containers" ] && docker_on $host rm -f $containers >/dev/null 2>&1
weave_on $host reset 2>/dev/null weave_on $host reset 2>/dev/null
done done
whitely echo $@ whitely echo "$@"
} }
end_suite() { end_suite() {