Merge pull request #925 from bboreham/922-remove-dot
Remove trailing dot from hostnames. Fixes #922.
This commit is contained in:
commit
9a99a51e14
4 files changed
+6
-4
No files matched your search
+1
-1
@@ -36,7 +36,7 @@ func ServeHTTP(listener net.Listener, version string, server *DNSServer, dockerC
|
||||
})
|
||||
|
||||
muxRouter.Methods("GET").Path("/domain").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, server.Zone.Domain())
|
||||
fmt.Fprint(w, server.Zone.Domain())
|
||||
})
|
||||
|
||||
muxRouter.Methods("PUT").Path("/name/{id:.+}/{ip:.+}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -94,7 +94,8 @@ func (i *createContainerInterceptor) setWeaveDNS(container *createContainerReque
|
||||
name := r.URL.Query().Get("name")
|
||||
if container.Hostname == "" && name != "" {
|
||||
container.Hostname = name
|
||||
container.Domainname = i.getDNSDomain()
|
||||
// Strip trailing period because it's unusual to see it used on the end of a host name
|
||||
container.Domainname = strings.TrimSuffix(i.getDNSDomain(), ".")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. ./config.sh
|
||||
|
||||
NAME=c1
|
||||
DOMAIN=weave.local.
|
||||
DOMAIN=weave.local
|
||||
HOSTNAME=$NAME-hostname.$DOMAIN
|
||||
|
||||
# Docker inspect hostname + domainname of container $2 on host $1
|
||||
|
||||
@@ -660,7 +660,8 @@ dns_args() {
|
||||
DNS_ARGS="$DNS_ARG $DNS_SEARCH_ARG"
|
||||
if [ -n "$NAME_ARG" -a -z "$HOSTNAME_SPECIFIED" ] ; then
|
||||
DOMAIN=$(call_dns GET /domain 2>/dev/null) || DOMAIN=weave.local.
|
||||
DNS_ARGS="$DNS_ARGS --hostname=$NAME_ARG.$DOMAIN"
|
||||
# Strip trailing period off DNS domain to reduce surprise
|
||||
DNS_ARGS="$DNS_ARGS --hostname=$NAME_ARG.${DOMAIN%.}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user