stop weavedns from complaining when a container has no docker ip

e.g. when it was started with --net=none

weavedns wasn't actually using the docker-assigned ip for anything, so
this change is a simple matter of eradicating it from the code.
This commit is contained in:
Matthias Radestock committed 2014-11-27 16:13:06 +00:00
1 parent 65c77df279
commit 24702e3a7a
5 files changed
+14 -27

No files matched your search

+3 -10
View File
@@ -47,18 +47,11 @@ func ListenHttp(domain string, db Zone, port int) {
case "PUT":
ident, weaveIPstr, err := parseUrl(r.URL.Path)
name := r.FormValue("fqdn")
localIPstr := r.FormValue("local_ip")
if ident == "" || weaveIPstr == "" || name == "" || localIPstr == "" {
if ident == "" || weaveIPstr == "" || name == "" {
reqError("Invalid request", "Invalid request: %s, %s", r.URL, r.Form)
return
}
localIP := net.ParseIP(localIPstr)
if localIP == nil {
reqError("Invalid IP in request", "Invalid IP in request: %s", localIPstr)
return
}
weaveIP := net.ParseIP(weaveIPstr)
if weaveIP == nil {
reqError("Invalid weave IP", "Invalid weave IP in request: %s", weaveIPstr)
@@ -66,8 +59,8 @@ func ListenHttp(domain string, db Zone, port int) {
}
if dns.IsSubDomain(domain, name) {
Info.Printf("Adding %s (%s) -> %s", name, localIPstr, weaveIPstr)
if err = db.AddRecord(ident, name, localIP, weaveIP); err != nil {
Info.Printf("Adding %s -> %s", name, weaveIPstr)
if err = db.AddRecord(ident, name, weaveIP); err != nil {
if dup, ok := err.(DuplicateError); !ok {
httpErrorAndLog(
Error, w, "Internal error", http.StatusInternalServerError,