mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-13 08:34:45 +08:00
PACKETFRAME: Adopt diff2 in compatibility mode (#1898)
This commit is contained in:
parent
3e3d655e77
commit
f995f21d0e
1 changed files with 57 additions and 54 deletions
|
@ -125,10 +125,18 @@ func (api *packetframeProvider) GetDomainCorrections(dc *models.DomainConfig) ([
|
||||||
models.PostProcessRecords(existingRecords)
|
models.PostProcessRecords(existingRecords)
|
||||||
|
|
||||||
var corrections []*models.Correction
|
var corrections []*models.Correction
|
||||||
if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
|
var create, dels, modify diff.Changeset
|
||||||
|
if !diff2.EnableDiff2 {
|
||||||
differ := diff.New(dc)
|
differ := diff.New(dc)
|
||||||
_, create, delete, modify, err := differ.IncrementalDiff(existingRecords)
|
_, create, dels, modify, err = differ.IncrementalDiff(existingRecords)
|
||||||
|
} else {
|
||||||
|
differ := diff.NewCompat(dc)
|
||||||
|
_, create, dels, modify, err = differ.IncrementalDiff(existingRecords)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -148,7 +156,7 @@ func (api *packetframeProvider) GetDomainCorrections(dc *models.DomainConfig) ([
|
||||||
corrections = append(corrections, corr)
|
corrections = append(corrections, corr)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, m := range delete {
|
for _, m := range dels {
|
||||||
original := m.Existing.Original.(*domainRecord)
|
original := m.Existing.Original.(*domainRecord)
|
||||||
if original.ID == "0" { // Skip the default nameservers
|
if original.ID == "0" { // Skip the default nameservers
|
||||||
continue
|
continue
|
||||||
|
@ -182,11 +190,6 @@ func (api *packetframeProvider) GetDomainCorrections(dc *models.DomainConfig) ([
|
||||||
corrections = append(corrections, corr)
|
corrections = append(corrections, corr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return corrections, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert Future diff2 version here.
|
|
||||||
|
|
||||||
return corrections, nil
|
return corrections, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue