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

CLOUDFLARE: Adopt diff2 (#2040)

This commit is contained in:
Tom Limoncelli
2023-02-01 16:18:01 -05:00
committed by GitHub
parent 510d60f116
commit e1ce6ff34f
6 changed files with 329 additions and 97 deletions

View File

@ -191,11 +191,15 @@ func (cc *CompareConfig) String() string {
// Generate a string that can be used to compare this record to others
// for equality.
func comparable(rc *models.RecordConfig, f func(*models.RecordConfig) string) string {
func mkCompareBlob(rc *models.RecordConfig, f func(*models.RecordConfig) string) string {
if f == nil {
return rc.ToDiffable()
}
return rc.ToDiffable() + " " + f(rc)
addOn := f(rc)
if addOn != "" {
return rc.ToDiffable() + " " + f(rc)
}
return rc.ToDiffable()
}
func (cc *CompareConfig) addRecords(recs models.Records, storeInExisting bool) {
@ -213,7 +217,7 @@ func (cc *CompareConfig) addRecords(recs models.Records, storeInExisting bool) {
label := rec.NameFQDN
rtype := rec.Type
comp := comparable(rec, cc.compareableFunc)
comp := mkCompareBlob(rec, cc.compareableFunc)
// Are we seeing this label for the first time?
var labelIdx int