CSCGLOBAL: Adopt diff2 in compatibility mode
@@ -118,10 +118,15 @@ func (client *providerClient) 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
}
@@ -168,7 +173,6 @@ func (client *providerClient) GenerateDomainCorrections(dc *models.DomainConfig,
edits = append(edits, makeEdit(dc.Name, m))
descriptions = append(descriptions, m.String())
}
- corrections := []*models.Correction{}
if len(edits) > 0 {
c := &models.Correction{
Msg: "\t" + strings.Join(descriptions, "\n\t"),
@@ -188,13 +192,8 @@ func (client *providerClient) GenerateDomainCorrections(dc *models.DomainConfig,
}
corrections = append(corrections, c)
}
- return corrections, nil
- }
-
- // Insert Future diff2 version here.
return corrections, nil
-
}
func makePurge(domainname string, cor diff.Correlation) zoneResourceRecordEdit {
