Skip to content

Commit

Permalink
debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bamarni committed Apr 25, 2016
1 parent d36d821 commit 70d9683
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dockness.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

var api *libmachine.Client
var ttl uint
var user string

func lookup(w dns.ResponseWriter, r *dns.Msg) {
m := new(dns.Msg)
Expand All @@ -31,23 +30,25 @@ func lookup(w dns.ResponseWriter, r *dns.Msg) {
domLevels := strings.Split(q.Name, ".")
domLevelsLen := len(domLevels)
if domLevelsLen < 3 {
log.Printf("Couldn't parse the DNS question '%s'", q.Name)
mcnlog.Debugf("Couldn't parse the DNS question '%s'", q.Name)
continue
}
machineName := domLevels[len(domLevels)-3]

machine, err := api.Load(machineName)
if err != nil {
log.Printf("Couldn't load machine '%s' : %s", machineName, err)
mcnlog.Debugf("Couldn't load machine '%s' : %s", machineName, err)
continue
}

ip, err := machine.Driver.GetIP()
if err != nil {
log.Printf("Couldn't find IP for machine '%s' : %s", machineName, err)
mcnlog.Debugf("Couldn't find IP for machine '%s' : %s", machineName, err)
continue
}

mcnlog.Debugf("Found IP %s for machine '%s'", ip, machineName)

rr = &dns.A{
Hdr: dns.RR_Header{
Name: q.Name,
Expand Down

0 comments on commit 70d9683

Please sign in to comment.