Update logging / comment semantics about DNSRecord.Name
This commit is contained in:
parent
776bc10fb5
commit
0400c2f406
2 changed files with 6 additions and 7 deletions
|
@ -77,9 +77,8 @@ func (api API) performRequest(method, url string, body io.Reader) (response []by
|
|||
return ioutil.ReadAll(resp.Body)
|
||||
}
|
||||
|
||||
// Create a DNS record for a given domain. The hostname is
|
||||
// specified in the DNSRecord under name, and should not
|
||||
// include the domain.
|
||||
// Create a DNS record for a given domain. The name
|
||||
// field in DNSRecord is in the format [hostname].[domainname]
|
||||
func (api API) CreateDNSRecord(domain string, record DNSRecord) error {
|
||||
b, err := json.Marshal(record)
|
||||
if err != nil {
|
||||
|
|
|
@ -12,13 +12,13 @@ import (
|
|||
var wg sync.WaitGroup
|
||||
|
||||
func updateDNSRecord(a api.API, domain, recordId string, newRecord api.DNSRecord) error {
|
||||
log.Logger.Printf("Deleting DNS record for %s.%s.\n", newRecord.Name, domain)
|
||||
log.Logger.Printf("Deleting DNS record for %s.\n", newRecord.Name)
|
||||
err := a.DeleteDNSRecord(domain, newRecord.RecordId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Logger.Printf("Creating DNS record for %s.%s: %s\n", newRecord.Name, domain, newRecord)
|
||||
log.Logger.Printf("Creating DNS record for %s: %s\n", newRecord.Name, newRecord)
|
||||
return a.CreateDNSRecord(domain, newRecord)
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,9 @@ func runConfig(c api.Config, daemon bool) {
|
|||
r.Content = ip
|
||||
err = updateDNSRecord(a, c.Domain, r.RecordId, r)
|
||||
if err != nil {
|
||||
log.Logger.Printf("Failed to update record %s [%s.%s] with IP: %s\n\t%s\n", r.RecordId, r.Name, c.Domain, ip, err)
|
||||
log.Logger.Printf("Failed to update record %s [%s] with IP: %s\n\t%s\n", r.RecordId, r.Name, ip, err)
|
||||
} else {
|
||||
log.Logger.Printf("Attempting to update record %s [%s.%s] with IP: %s\n", r.RecordId, r.Name, c.Domain, ip)
|
||||
log.Logger.Printf("Attempting to update record %s [%s] with IP: %s\n", r.RecordId, r.Name, ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue