From 436f8ef7c836ca14cec43be4da25b92f063fa9f3 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 10 Feb 2016 17:37:26 +0000 Subject: [PATCH] Compare the environment so we can detect a change in password --- test/175_stop_start_test.sh | 9 +++++++++ weave | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/175_stop_start_test.sh b/test/175_stop_start_test.sh index 56df0409..791d7a8c 100755 --- a/test/175_stop_start_test.sh +++ b/test/175_stop_start_test.sh @@ -13,6 +13,15 @@ assert_raises "weave_on $HOST1 launch-router --log-level=debug" 1 weave_on $HOST1 stop-router ID2=$(weave_on $HOST1 launch-router --log-level=debug) assert "[ $ID != $ID2 ]" + +# Stop then start with different password +weave_on $HOST1 stop-router +ID3=$(weave_on $HOST1 launch-router --password=xyzzy) +assert "[ $ID2 != $ID3 ]" +# Stop then start with same password +weave_on $HOST1 stop-router +assert "weave_on $HOST1 launch-router --password=xyzzy" "$ID3" + # Fails on bad argument assert_raises "weave_on $HOST1 launch-plugin --foo" 1 # Fails again on bad argument, although there is a dead container diff --git a/weave b/weave index 3cfd1063..80377906 100755 --- a/weave +++ b/weave @@ -937,10 +937,10 @@ detach() { ###################################################################### args_match() { - prev_args="$(docker inspect -f '{{.Args}}' $1)" + prev_args="$(docker inspect -f '{{.Args}} {{.Config.Env}}' $1)" shift dummy_container=$(docker create "$@" 2>/dev/null) || return 1 - dummy_args="$(docker inspect -f '{{.Args}}' $dummy_container)" + dummy_args="$(docker inspect -f '{{.Args}} {{.Config.Env}}' $dummy_container)" docker rm $dummy_container >/dev/null [ "$prev_args" = "$dummy_args" ] }