From 370212609cb0cb0dd5f24d62eb6d0df9902915e3 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 31 Dec 2015 10:05:41 +0000 Subject: [PATCH 1/3] Show expected error message when docker_tls_args fails. And also make the error message more meaningful. Fixes #1843. --- weave | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/weave b/weave index 60d1f2bd..30e29b84 100755 --- a/weave +++ b/weave @@ -1456,9 +1456,13 @@ proxy_args() { proxy_parse_args "$@" if [ -z "$PROXY_TLS_ENABLED" ] ; then - if [ -z "$PROXY_TLS_DETECTION_DISABLED" ] && ! proxy_parse_args $(docker_tls_args) ; then - echo "Unable to auto-detect TLS configuration, --no-detect-tls or TLS options are required." >&2 - exit 1 + if [ -z "$PROXY_TLS_DETECTION_DISABLED" ] ; then + if ! DOCKER_TLS_ARGS=$(docker_tls_args) ; then + echo "Unable to auto-detect proxy TLS configuration; you must launch the proxy with" >&2 + echo "'weave launch-proxy' and supply '--no-detect-tls' or TLS options." >&2 + exit 1 + fi + proxy_parse_args "$DOCKER_TLS_ARGS" fi fi if [ -z "$PROXY_HOST" ] ; then From c1b1276aaf22fbbc945b5e99a8ac40c1c6b6d358 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 31 Dec 2015 10:16:37 +0000 Subject: [PATCH 2/3] refactor: simplify --- weave | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/weave b/weave index 30e29b84..73ce4012 100755 --- a/weave +++ b/weave @@ -1455,15 +1455,13 @@ proxy_args() { PROXY_HOST="" proxy_parse_args "$@" - if [ -z "$PROXY_TLS_ENABLED" ] ; then - if [ -z "$PROXY_TLS_DETECTION_DISABLED" ] ; then - if ! DOCKER_TLS_ARGS=$(docker_tls_args) ; then - echo "Unable to auto-detect proxy TLS configuration; you must launch the proxy with" >&2 - echo "'weave launch-proxy' and supply '--no-detect-tls' or TLS options." >&2 - exit 1 - fi - proxy_parse_args "$DOCKER_TLS_ARGS" - fi + if [ -z "$PROXY_TLS_ENABLED" -a -z "$PROXY_TLS_DETECTION_DISABLED" ] ; then + if ! DOCKER_TLS_ARGS=$(docker_tls_args) ; then + echo "Unable to auto-detect proxy TLS configuration; you must launch the proxy with" >&2 + echo "'weave launch-proxy' and supply '--no-detect-tls' or TLS options." >&2 + exit 1 + fi + proxy_parse_args "$DOCKER_TLS_ARGS" fi if [ -z "$PROXY_HOST" ] ; then case "$DOCKER_CLIENT_HOST" in From a9d212c8887b265496c87e882befb96c93b1861f Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 31 Dec 2015 10:43:46 +0000 Subject: [PATCH 3/3] don't fail on missing docker_tls_args instead just don't auto-detect TLS args in that case. This makes `weave --local launch` work (again). Fixes #1844. --- weave | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weave b/weave index 73ce4012..c66b61df 100755 --- a/weave +++ b/weave @@ -1455,7 +1455,7 @@ proxy_args() { PROXY_HOST="" proxy_parse_args "$@" - if [ -z "$PROXY_TLS_ENABLED" -a -z "$PROXY_TLS_DETECTION_DISABLED" ] ; then + if [ -z "$PROXY_TLS_ENABLED" -a -z "$PROXY_TLS_DETECTION_DISABLED" ] && command_exists docker_tls_args ; then if ! DOCKER_TLS_ARGS=$(docker_tls_args) ; then echo "Unable to auto-detect proxy TLS configuration; you must launch the proxy with" >&2 echo "'weave launch-proxy' and supply '--no-detect-tls' or TLS options." >&2