POWERDNS: Adopt diff2 in compatibility mode (#1899)

This commit is contained in:
Tom Limoncelli 2023-01-13 13:00:49 -05:00 committed by GitHub
parent 81f75ed154
commit b4cbd1299f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 60 deletions

View file

@ -228,7 +228,7 @@ func toRc(dc *models.DomainConfig, r *domainRecord) *models.RecordConfig {
switch rtype := r.Type; rtype { // #rtype_variations
case "TXT":
rc.SetTargetTXTString(r.Value)
rc.SetTargetTXT(r.Value)
case "SRV":
spl := strings.Split(r.Value, " ")
prio, _ := strconv.ParseUint(spl[0], 10, 16)

View file

@ -62,11 +62,13 @@ func (dsp *powerdnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*m
}
models.PostProcessRecords(curRecords)
var corrections []*models.Correction
if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
// create record diff by group
keysToUpdate, err := (diff.New(dc)).ChangedGroups(curRecords)
var keysToUpdate map[models.RecordKey][]string
if !diff2.EnableDiff2 {
keysToUpdate, err = (diff.New(dc)).ChangedGroups(curRecords)
} else {
keysToUpdate, err = (diff.NewCompat(dc)).ChangedGroups(curRecords)
}
if err != nil {
return nil, err
}
@ -115,6 +117,7 @@ func (dsp *powerdnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*m
// append corrections in the right order
// delete corrections must be run first to avoid correlations with existing RR
var corrections []*models.Correction
corrections = append(corrections, dCorrections...)
corrections = append(corrections, cuCorrections...)
@ -125,11 +128,6 @@ func (dsp *powerdnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*m
}
corrections = append(corrections, dnssecCorrections...)
return corrections, nil
}
// Insert Future diff2 version here.
return corrections, nil
}