Merge pull request #1528 from weaveworks/weave-env-bug

[proxy] Fix bug in weave env/config when passing multiple -H flags

Fixes #1527
This commit is contained in:
Matthias Radestock committed 2015-10-14 15:50:42 +01:00
commit 8cfc8b3132
2 files changed
+24 -9

No files matched your search

+11 -5
View File
@@ -1200,15 +1200,21 @@ proxy_args() {
fi
}
proxy_addr() {
if addr=$(http_call_unix $PROXY_CONTAINER_NAME status.sock GET /status 2>&1) ; then
echo "$addr" | head -n1 | sed "s/0.0.0.0/$PROXY_HOST/g"
proxy_addrs() {
if addr="$(http_call_unix $PROXY_CONTAINER_NAME status.sock GET /status 2>&1)" ; then
echo "$addr" | sed "s/0.0.0.0/$PROXY_HOST/g"
else
echo "$PROXY_CONTAINER_NAME container is not present. Have you launched it?" >&2
return 1
fi
}
proxy_addr() {
addr=$(proxy_addrs) || return 1
echo "$addr" | cut -d ' ' -f1
}
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)'."
@@ -1570,10 +1576,10 @@ case "$COMMAND" in
else
res=1
fi
if [ -z "$SUB_STATUS" ] && check_running $PROXY_CONTAINER_NAME 2>/dev/null && PROXY_ADDR=$(proxy_addr) ; then
if [ -z "$SUB_STATUS" ] && check_running $PROXY_CONTAINER_NAME 2>/dev/null && PROXY_ADDRS=$(proxy_addrs) ; then
echo
echo " Service: proxy"
echo " Address: $PROXY_ADDR"
echo " Address: $PROXY_ADDRS"
fi
[ -n "$SUB_STATUS" ] || echo
[ $res -eq 0 ]