remove one level of indentation
This commit is contained in:
1 parent
799e202d6d
commit
7941612dad
1 file changed
+25
-25
+25
-25
@@ -57,32 +57,32 @@ func ServeHTTP(listener net.Listener, version string, server *DNSServer, dockerC
|
||||
}
|
||||
|
||||
domain := server.Zone.Domain()
|
||||
if dns.IsSubDomain(domain, name) {
|
||||
Info.Printf("[http] Adding %s -> %s", name, ipStr)
|
||||
if err := server.Zone.AddRecord(idStr, name, ip); err != nil {
|
||||
if _, ok := err.(DuplicateError); !ok {
|
||||
httpErrorAndLog(
|
||||
Error, w, "Internal error", http.StatusInternalServerError,
|
||||
"Unexpected error from DB: %s", err)
|
||||
return
|
||||
} // oh, I already know this. whatever.
|
||||
}
|
||||
|
||||
if dockerCli != nil {
|
||||
if !docker.IsContainerID(idStr) {
|
||||
Debug.Printf("[http] '%s' does not seem a container id", idStr)
|
||||
return
|
||||
}
|
||||
|
||||
if running, err := dockerCli.IsContainerRunning(idStr); err != nil {
|
||||
Error.Printf("[http] Could not check container status: %s", err)
|
||||
} else if !running {
|
||||
Info.Printf("[http] '%s' is not running: removing", idStr)
|
||||
server.Zone.DeleteRecords(idStr, name, ip)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !dns.IsSubDomain(domain, name) {
|
||||
Info.Printf("[http] Ignoring name %s, not in %s", name, domain)
|
||||
return
|
||||
}
|
||||
Info.Printf("[http] Adding %s -> %s", name, ipStr)
|
||||
if err := server.Zone.AddRecord(idStr, name, ip); err != nil {
|
||||
if _, ok := err.(DuplicateError); !ok {
|
||||
httpErrorAndLog(
|
||||
Error, w, "Internal error", http.StatusInternalServerError,
|
||||
"Unexpected error from DB: %s", err)
|
||||
return
|
||||
} // oh, I already know this. whatever.
|
||||
}
|
||||
|
||||
if dockerCli != nil {
|
||||
if !docker.IsContainerID(idStr) {
|
||||
Debug.Printf("[http] '%s' does not seem to be a container id", idStr)
|
||||
return
|
||||
}
|
||||
|
||||
if running, err := dockerCli.IsContainerRunning(idStr); err != nil {
|
||||
Error.Printf("[http] Could not check container status: %s", err)
|
||||
} else if !running {
|
||||
Info.Printf("[http] '%s' is not running: removing", idStr)
|
||||
server.Zone.DeleteRecords(idStr, name, ip)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user