mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
ROUTE53: fix R53_ZONE() handling for domains (#2306)
Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
@@ -514,48 +514,26 @@ func ValidateAndNormalizeConfig(config *models.DNSConfig) (errs []error) {
|
||||
return errs
|
||||
}
|
||||
|
||||
// UpdateNameSplitHorizon fills in the split horizon fields.
|
||||
func UpdateNameSplitHorizon(dc *models.DomainConfig) {
|
||||
if dc.UniqueName == "" {
|
||||
dc.UniqueName = dc.Name
|
||||
}
|
||||
if dc.Tag == "" {
|
||||
l := strings.SplitN(dc.Name, "!", 2)
|
||||
if len(l) == 2 {
|
||||
dc.Name = l[0]
|
||||
dc.Tag = l[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// processSplitHorizonDomains finds "domain.tld!tag" domains and pre-processes them.
|
||||
func processSplitHorizonDomains(config *models.DNSConfig) error {
|
||||
// Parse out names and tags.
|
||||
for _, d := range config.Domains {
|
||||
UpdateNameSplitHorizon(d)
|
||||
d.UpdateSplitHorizonNames()
|
||||
}
|
||||
|
||||
// Verify uniquenames are unique
|
||||
seen := map[string]bool{}
|
||||
for _, d := range config.Domains {
|
||||
if seen[d.UniqueName] {
|
||||
return fmt.Errorf("duplicate domain name: %q", d.UniqueName)
|
||||
uniquename := d.GetUniqueName()
|
||||
if seen[uniquename] {
|
||||
return fmt.Errorf("duplicate domain name: %q", uniquename)
|
||||
}
|
||||
seen[d.UniqueName] = true
|
||||
seen[uniquename] = true
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
//// parseDomainSpec parses "domain.tld!tag" into its component parts.
|
||||
//func parseDomainSpec(s string) (domain, tag string) {
|
||||
// l := strings.SplitN(s, "!", 2)
|
||||
// if len(l) == 2 {
|
||||
// return l[0], l[1]
|
||||
// }
|
||||
// return l[0], ""
|
||||
//}
|
||||
|
||||
func checkAutoDNSSEC(dc *models.DomainConfig) (errs []error) {
|
||||
if strings.ToLower(dc.RegistrarName) == "none" {
|
||||
return
|
||||
|
||||
@@ -8,7 +8,8 @@ import (
|
||||
// post-processing, and then calls GetZoneRecordsCorrections. The
|
||||
// name sucks because all the good names were taken.
|
||||
func CorrectZoneRecords(driver models.DNSProvider, dc *models.DomainConfig) ([]*models.Correction, error) {
|
||||
existingRecords, err := driver.GetZoneRecords(dc.Name)
|
||||
|
||||
existingRecords, err := driver.GetZoneRecords(dc.Name, dc.Metadata)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user