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

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
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 switch rtype := r.Type; rtype { // #rtype_variations
case "TXT": case "TXT":
rc.SetTargetTXTString(r.Value) rc.SetTargetTXT(r.Value)
case "SRV": case "SRV":
spl := strings.Split(r.Value, " ") spl := strings.Split(r.Value, " ")
prio, _ := strconv.ParseUint(spl[0], 10, 16) prio, _ := strconv.ParseUint(spl[0], 10, 16)

View File

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