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

@@ -134,6 +134,8 @@ func (r *route53Provider) ListZones() ([]string, error) {
}
func (r *route53Provider) getZones() error {
// TODO(tlim) This should memoize itself.
if r.zonesByDomain != nil {
return nil
}
@@ -223,6 +225,8 @@ func (r *route53Provider) GetZoneRecords(domain string) (models.Records, error)
}
func (r *route53Provider) getZone(dc *models.DomainConfig) (r53Types.HostedZone, error) {
// TODO(tlim) This should memoize itself.
if err := r.getZones(); err != nil {
return r53Types.HostedZone{}, err
}
@@ -260,19 +264,15 @@ func (r *route53Provider) getZoneRecords(zone r53Types.HostedZone) (models.Recor
return existingRecords, nil
}
func (r *route53Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
dc.Punycode()
// GetZoneRecordsCorrections returns a list of corrections that will turn existing records into dc.Records.
func (r *route53Provider) GetZoneRecordsCorrections(dc *models.DomainConfig, existingRecords models.Records) ([]*models.Correction, error) {
txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
zone, err := r.getZone(dc)
if err != nil {
return nil, err
}
existingRecords, err := r.getZoneRecords(zone)
if err != nil {
return nil, err
}
// update zone_id to current zone.id if not specified by the user
for _, want := range dc.Records {
if want.Type == "R53_ALIAS" && want.R53Alias["zone_id"] == "" {
@@ -280,13 +280,14 @@ func (r *route53Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
}
}
// Normalize
models.PostProcessRecords(existingRecords)
txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
var corrections []*models.Correction
if !diff2.EnableDiff2 {
zone, err := r.getZone(dc)
if err != nil {
return nil, err
}
// diff
differ := diff.New(dc, getAliasMap)
namesToUpdate, err := differ.ChangedGroups(existingRecords)