From 9fddad02adaa100a03c007de1e6b7cece3918030 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Wed, 10 Jun 2015 11:14:51 +0100 Subject: [PATCH] Add dns_domain helper to weave script --- weave | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/weave b/weave index 0383ac6b..4b1aeee0 100755 --- a/weave +++ b/weave @@ -660,6 +660,16 @@ dns_args() { DNS_ARGS="$DNS_ARG $DNS_SEARCH_ARG" } +# Use the weaveDNS REST API to determine the local domain. If weaveDNS is not +# running, return the default value ('weave.local.') +dns_domain() { + if DOMAIN=$(http_call $DNS_CONTAINER_NAME $DNS_HTTP_PORT GET /domain 2>/dev/null) ; then + echo $DOMAIN + else + echo 'weave.local.' + fi +} + # Print an error to stderr and return with an indicative exit status # if the container $1 does not exist or isn't running. check_running() { @@ -1069,6 +1079,9 @@ case "$COMMAND" in dns_args "$@" echo -n $DNS_ARGS ;; + dns-domain) + echo $(dns_domain) + ;; docker-bridge-ip) docker_bridge_ip echo -n $DOCKER_BRIDGE_IP