From be8260ae79a4b7c2ac239464c54859c60ce2017c Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Fri, 1 Jan 2016 23:52:46 +0000 Subject: [PATCH] refactor: pass procfs location to docker_tls_args on command line ...rather than via an env var. This is cleaner. --- prog/docker_tls_args/main.go | 9 ++++----- weave | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/prog/docker_tls_args/main.go b/prog/docker_tls_args/main.go index 37c747a5..43c15821 100644 --- a/prog/docker_tls_args/main.go +++ b/prog/docker_tls_args/main.go @@ -1,6 +1,5 @@ // docker_tls_args: find the docker daemon's tls args -// This reimplements pgrep, because pgrep will only look in /proc, but not in -// $PROCFS. +// This reimplements pgrep, because pgrep will only look in /proc. package main import ( @@ -14,9 +13,9 @@ import ( ) func main() { - procRoot := os.Getenv("PROCFS") - if procRoot == "" { - procRoot = "/proc" + procRoot := "/proc" + if len(os.Args) > 1 { + procRoot = os.Args[1] } dirEntries, err := ioutil.ReadDir(procRoot) diff --git a/weave b/weave index 089b0153..592233e6 100755 --- a/weave +++ b/weave @@ -1435,7 +1435,7 @@ proxy_args() { proxy_parse_args "$@" 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 + if ! DOCKER_TLS_ARGS=$(docker_tls_args ${PROCFS:-/proc}) ; 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