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:
34
pkg/zonerecs/zonerecords.go
Normal file
34
pkg/zonerecs/zonerecords.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package zonerecs
|
||||
|
||||
import (
|
||||
"github.com/StackExchange/dnscontrol/v3/models"
|
||||
)
|
||||
|
||||
// CorrectZoneRecords calls both GetZoneRecords, does any
|
||||
// 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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// downcase
|
||||
models.Downcase(existingRecords)
|
||||
|
||||
// Copy dc so that any corrections code that wants to
|
||||
// modify the records may. For example, if the provider only
|
||||
// supports certain TTL values, it will adjust the ones in
|
||||
// dc.Records.
|
||||
dc, err = dc.Copy()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// punycode
|
||||
dc.Punycode()
|
||||
// FIXME(tlim) It is a waste to PunyCode every iteration.
|
||||
// This should be moved to where the JavaScript is processed.
|
||||
|
||||
return driver.GetZoneRecordsCorrections(dc, existingRecords)
|
||||
}
|
Reference in New Issue
Block a user