Removing confusing variable from getDNSDomain, just return "" when disabled

This commit is contained in:
Paul Bellamy committed 2015-09-22 15:09:32 +01:00
1 parent 3e4d8a3ffe
commit 547c9e7f5a
3 files changed
+9 -7

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
}
}
hostname = i.proxy.hostnameMatchRegexp.ReplaceAllString(hostname, i.proxy.HostnameReplacement)
if dnsDomain, withDNS := i.proxy.getDNSDomain(); withDNS {
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
i.setHostname(&container, hostname, dnsDomain)
if err := i.proxy.setWeaveDNS(container.HostConfig, container.Hostname, dnsDomain); err != nil {
return err
+7 -5
View File
@@ -395,13 +395,15 @@ func (proxy *Proxy) setWeaveDNS(hostConfig *docker.HostConfig, hostname, dnsDoma
return nil
}
func (proxy *Proxy) getDNSDomain() (domain string, running bool) {
func (proxy *Proxy) getDNSDomain() (domain string) {
if proxy.WithoutDNS {
return "", false
return ""
}
if proxy.WithDNS {
domain = nameserver.DefaultDomain
}
domain = nameserver.DefaultDomain
running = proxy.WithDNS
weaveContainer, err := proxy.client.InspectContainer("weave")
if err != nil ||
weaveContainer.NetworkSettings == nil ||
@@ -421,5 +423,5 @@ func (proxy *Proxy) getDNSDomain() (domain string, running bool) {
return
}
return string(b), true
return string(b)
}
+1 -1
View File
@@ -29,7 +29,7 @@ func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
}
i.proxy.addWeaveWaitVolume(hostConfig)
if dnsDomain, withDNS := i.proxy.getDNSDomain(); withDNS {
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, dnsDomain); err != nil {
return err
}