[proxy] Fix bug in weave env/config when passing multiple -H flags
The echo in proxy_addr was not preserving newlines, so the multiple addrs were all getting returned
This commit is contained in:
1 parent
d5e63b875b
commit
fd07f59d16
2 files changed
+26
-11
No files matched your search
@@ -1072,15 +1072,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)'."
|
||||
@@ -1377,8 +1383,8 @@ case "$COMMAND" in
|
||||
;;
|
||||
config|proxy-config)
|
||||
[ "$COMMAND" = "config" ] || deprecation_warning "$COMMAND" "'weave config'"
|
||||
if PROXY_addr=$(proxy_addr) ; then
|
||||
echo "-H=$PROXY_addr"
|
||||
if PROXY_ADDR=$(proxy_addr) ; then
|
||||
echo "-H=$PROXY_ADDR"
|
||||
fi
|
||||
;;
|
||||
connect)
|
||||
@@ -1419,10 +1425,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 ]
|
||||
|
||||
Reference in new issue
Block a user