mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
DESEC: Adopt diff2 in compatibility mode (#1876)
This commit is contained in:
@ -166,14 +166,20 @@ func PrepDesiredRecords(dc *models.DomainConfig, minTTL uint32) {
|
|||||||
func (c *desecProvider) GenerateDomainCorrections(dc *models.DomainConfig, existing models.Records) ([]*models.Correction, error) {
|
func (c *desecProvider) GenerateDomainCorrections(dc *models.DomainConfig, existing models.Records) ([]*models.Correction, error) {
|
||||||
|
|
||||||
var corrections []*models.Correction
|
var corrections []*models.Correction
|
||||||
if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
|
var err error
|
||||||
|
var keysToUpdate map[models.RecordKey][]string
|
||||||
|
if !diff2.EnableDiff2 {
|
||||||
// diff existing vs. current.
|
// diff existing vs. current.
|
||||||
differ := diff.New(dc)
|
differ := diff.New(dc)
|
||||||
keysToUpdate, err := differ.ChangedGroups(existing)
|
keysToUpdate, err = differ.ChangedGroups(existing)
|
||||||
|
} else {
|
||||||
|
differ := diff.NewCompat(dc)
|
||||||
|
keysToUpdate, err = differ.ChangedGroups(existing)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(keysToUpdate) == 0 {
|
if len(keysToUpdate) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -245,9 +251,3 @@ func (c *desecProvider) GenerateDomainCorrections(dc *models.DomainConfig, exist
|
|||||||
|
|
||||||
return corrections, nil
|
return corrections, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert Future diff2 version here.
|
|
||||||
|
|
||||||
// Insert Future diff2 version here.
|
|
||||||
return corrections, nil
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user