mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
GetNameservers is inconsistent across providers (#655)
* Warn if GetNameservers returns FQDN+dot strings * Simplify logic that covers for the inconsistency * Fix azuredns, gcloud, bind, route53 * Clean up cloudflare, digitalocean, dnsimple, gandi_v5, namedotcom
This commit is contained in:
@@ -26,16 +26,21 @@ func DetermineNameservers(dc *models.DomainConfig) ([]*models.Nameserver, error)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Clean up the nameservers due to
|
||||
// https://github.com/StackExchange/dnscontrol/issues/491
|
||||
// In the far future, this warning will become a fatal error.
|
||||
for i, _ := range nss {
|
||||
if strings.HasSuffix(nss[i].Name, ".") {
|
||||
models.WarnNameserverDot(dnsProvider.Name, fmt.Sprintf("DetermineNameservers (%s) (%s)", dc.Name, nss[i].Name))
|
||||
nss[i].Name = strings.TrimSuffix(nss[i].Name, ".")
|
||||
}
|
||||
}
|
||||
|
||||
take := len(nss)
|
||||
if n > 0 && n < take {
|
||||
take = n
|
||||
}
|
||||
for i := 0; i < take; i++ {
|
||||
nss[i].Name = strings.TrimRight(nss[i].Name, ".")
|
||||
// FIXME(tlim): Rather than correct broken providers, we should print
|
||||
// a warning that the provider should be updated to store the FQDN
|
||||
// with no trailing dot. See also providers/namedotcom/nameservers.go
|
||||
// Bug https://github.com/StackExchange/dnscontrol/issues/491
|
||||
ns = append(ns, nss[i])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user