MSDNS: Adopt diff2 in compatibility mode
@@ -15,16 +15,20 @@ func (client *msdnsProvider) GenerateDomainCorrections(dc *models.DomainConfig,
txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
var corrections []*models.Correction
- if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
-
+ var creates, dels, modifications diff.Changeset
+ var err error
+ if !diff2.EnableDiff2 {
differ := diff.New(dc)
- _, creates, dels, modifications, err := differ.IncrementalDiff(foundRecords)
+ _, creates, dels, modifications, err = differ.IncrementalDiff(foundRecords)
+ } else {
+ differ := diff.NewCompat(dc)
+ _, creates, dels, modifications, err = differ.IncrementalDiff(foundRecords)
+ }
if err != nil {
return nil, err
}
// Generate changes.
- corrections := []*models.Correction{}
for _, del := range dels {
corrections = append(corrections, client.deleteRec(client.dnsserver, dc.Name, del))
}
@@ -38,11 +42,6 @@ func (client *msdnsProvider) GenerateDomainCorrections(dc *models.DomainConfig,
}
- // Insert Future diff2 version here.
-
- return corrections, nil
-}
-
func (client *msdnsProvider) deleteRec(dnsserver, domainname string, cor diff.Correlation) *models.Correction {
rec := cor.Existing
return &models.Correction{
