From c7c669fd1174174b257b7d6d895f17710b713832 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 23 Dec 2015 09:08:56 +0000 Subject: [PATCH] make `eval $(weave env)` idempotent so that `weave $(env --restore)` does the right thing regardless of how many times `eval $(weave env)` was invoked previously. Fixes #1824. --- weave | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weave b/weave index 0b1d1e84..f657efd4 100755 --- a/weave +++ b/weave @@ -1880,7 +1880,8 @@ EOF env|proxy-env) [ "$COMMAND" = "env" ] || deprecation_warning "$COMMAND" "'weave env'" if PROXY_ADDR=$(proxy_addr) ; then - echo "export DOCKER_HOST=$PROXY_ADDR ORIG_DOCKER_HOST=$DOCKER_CLIENT_HOST" + [ "$PROXY_ADDR" = "$DOCKER_CLIENT_HOST" ] || RESTORE="ORIG_DOCKER_HOST=$DOCKER_CLIENT_HOST" + echo "export DOCKER_HOST=$PROXY_ADDR $RESTORE" fi ;; config|proxy-config)