Add dns_domain helper to weave script

This commit is contained in:
Adam Harrison authored and Paul Bellamy committed 2015-06-11 10:26:07 +01:00
1 parent a1007411ad
commit 9fddad02ad
1 file changed
+13
+13
View File
@@ -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