warn when stopping proxy when the env is using it

This commit is contained in:
Matthias Radestock committed 2015-08-18 18:08:02 +01:00
1 parent be94dcc8a3
commit a93a3e98b9
1 file changed
+8
+8
View File
@@ -1022,6 +1022,12 @@ proxy_addr() {
fi
}
warn_if_stopping_proxy_in_env() {
if PROXY_ADDR=$(proxy_addr 2>/dev/null) ; then
[ "$PROXY_ADDR" != "$DOCKER_CLIENT_HOST" ] || echo "WARNING: It appears that your environment is configured to use the Weave Docker API proxy. Stopping it will break this and subsequent docker invocations. To restore your environment, run '\$(eval weave env --restore)'."
fi
}
######################################################################
# launch helpers
######################################################################
@@ -1503,6 +1509,7 @@ case "$COMMAND" in
;;
stop)
[ $# -eq 0 ] || usage
warn_if_stopping_proxy_in_env
stop $PROXY_CONTAINER_NAME "Proxy"
stop $CONTAINER_NAME "Weave"
conntrack -D -p udp --dport $PORT >/dev/null 2>&1 || true
@@ -1514,6 +1521,7 @@ case "$COMMAND" in
;;
stop-proxy)
[ $# -eq 0 ] || usage
warn_if_stopping_proxy_in_env
stop $PROXY_CONTAINER_NAME "Proxy"
;;
reset)