Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Remove obsolete args parsing from dns-args
Browse files Browse the repository at this point in the history
It was used as part of 'weave run'; does not make sense to support
--name, -h, etc., on 'weave dns-args'.
  • Loading branch information
bboreham committed Jul 31, 2020
1 parent b0274e1 commit 5b2311b
Showing 1 changed file with 1 addition and 44 deletions.
45 changes: 1 addition & 44 deletions weave
Original file line number Diff line number Diff line change
Expand Up @@ -778,50 +778,7 @@ dns_args() {
DNS_DOMAIN=${DNS_DOMAIN:-weave.local.}
DNS_ADDRESS=${DNS_ADDRESS:-$(call_weave GET /dns-address 2>/dev/null)}

NAME_ARG=""
HOSTNAME_SPECIFIED=
DNS_SEARCH_SPECIFIED=
WITHOUT_DNS=
while [ $# -gt 0 ] ; do
case "$1" in
--without-dns)
WITHOUT_DNS=1
;;
--name)
NAME_ARG="$2"
shift
;;
--name=*)
NAME_ARG="${1#*=}"
;;
-h|--hostname|--hostname=*)
HOSTNAME_SPECIFIED=1
;;
--dns-search|--dns-search=*)
DNS_SEARCH_SPECIFIED=1
;;
esac
shift
done
[ -n "$WITHOUT_DNS" ] && return 0

DNS_ARGS="--dns=$DNS_ADDRESS"
if [ -n "$NAME_ARG" -a -z "$HOSTNAME_SPECIFIED" ] ; then
HOSTNAME="$NAME_ARG.${DNS_DOMAIN%.}"
if [ ${#HOSTNAME} -gt 64 ] ; then
echo "Container name too long to be used as hostname" >&2
else
DNS_ARGS="$DNS_ARGS --hostname=$HOSTNAME"
HOSTNAME_SPECIFIED=1
fi
fi
if [ -z "$DNS_SEARCH_SPECIFIED" ] ; then
if [ -z "$HOSTNAME_SPECIFIED" ] ; then
DNS_ARGS="$DNS_ARGS --dns-search=$DNS_DOMAIN"
else
DNS_ARGS="$DNS_ARGS --dns-search=."
fi
fi
DNS_ARGS="--dns=$DNS_ADDRESS --dns-search=$DNS_DOMAIN"
}

# Iff the container in $1 has an FQDN, invoke $2 as a command passing
Expand Down

0 comments on commit 5b2311b

Please sign in to comment.