1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

BUG: Some DNS zones are downloaded twice (#2120)

Signed-off-by: Amelia Aronsohn <squirrel@wearing.black>
Co-authored-by: Tom Limoncelli <tal@whatexit.org>
Co-authored-by: Grégoire Henry <hnrgrgr@users.noreply.github.com>
Co-authored-by: Amelia Aronsohn <squirrel@wearing.black>
Co-authored-by: Kai Schwarz <kschwarz@hexonet.net>
Co-authored-by: Asif Nawaz <asif.nawaz@centralnic.com>
Co-authored-by: imlonghao <git@imlonghao.com>
Co-authored-by: Will Power <1619102+willpower232@users.noreply.github.com>
This commit is contained in:
Tom Limoncelli
2023-04-14 15:22:23 -04:00
committed by GitHub
parent 61559f6a96
commit 60470a3886
56 changed files with 994 additions and 1186 deletions

View File

@@ -71,14 +71,45 @@ func (c *cloudnsProvider) GetNameservers(domain string) ([]*models.Nameserver, e
return models.ToNameservers(c.nameserversNames)
}
// GetDomainCorrections returns the corrections for a domain.
func (c *cloudnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
dc, err := dc.Copy()
if err != nil {
return nil, err
}
// // GetDomainCorrections returns the corrections for a domain.
// func (c *cloudnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
// dc, err := dc.Copy()
// if err != nil {
// return nil, err
// }
dc.Punycode()
// dc.Punycode()
// if c.domainIndex == nil {
// if err := c.fetchDomainList(); err != nil {
// return nil, err
// }
// }
// _, ok := c.domainIndex[dc.Name]
// if !ok {
// return nil, fmt.Errorf("'%s' not a zone in ClouDNS account", dc.Name)
// }
// existingRecords, err := c.GetZoneRecords(dc.Name)
// if err != nil {
// return nil, err
// }
// // Normalize
// models.PostProcessRecords(existingRecords)
// // Get a list of available TTL values.
// // The TTL list needs to be obtained for each domain, so get it first here.
// c.fetchAvailableTTLValues(dc.Name)
// // ClouDNS can only be specified from a specific TTL list, so change the TTL in advance.
// for _, record := range dc.Records {
// record.TTL = fixTTL(record.TTL)
// }
// return c.GetZoneRecordsCorrections(dc, existingRecords)
// }
// GetZoneRecordsCorrections returns a list of corrections that will turn existing records into dc.Records.
func (c *cloudnsProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, existingRecords models.Records) ([]*models.Correction, error) {
if c.domainIndex == nil {
if err := c.fetchDomainList(); err != nil {
@@ -90,13 +121,6 @@ func (c *cloudnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
return nil, fmt.Errorf("'%s' not a zone in ClouDNS account", dc.Name)
}
existingRecords, err := c.GetZoneRecords(dc.Name)
if err != nil {
return nil, err
}
// Normalize
models.PostProcessRecords(existingRecords)
// Get a list of available TTL values.
// The TTL list needs to be obtained for each domain, so get it first here.
c.fetchAvailableTTLValues(dc.Name)