From 3d2521dc65c200321ac50962c7f768369428ccb0 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Mon, 1 Jun 2015 10:16:26 +0000 Subject: [PATCH] Don't just advertise addresses on eth devices; use hostname -I. --- scope | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scope b/scope index 4333be4c9e..00474a8117 100755 --- a/scope +++ b/scope @@ -133,8 +133,11 @@ case "$COMMAND" in $WEAVESCOPE_DOCKER_ARGS $SCOPE_IMAGE $WEAVESCOPE_DNS_ARGS "$@") if dns_running; then - IP_ADDRS=$(find /sys/class/net -name eth* | xargs -n1 basename | xargs -n1 ip addr show | - grep inet | awk '{ print $2 }' | grep -oE "$IP_REGEXP" | xargs echo) + IP_ADDRS=$(hostname -I) + if [ -z "$IP_ADDRS" ]; then + echo "Could not determine local IP address; Weave DNS integration will not work correctly." + exit 1 + fi tell_dns_fqdn PUT $CONTAINER $FQDN $IP_ADDRS fi