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

NEW FEATURE: NO_PURGE reports what is not purged (diff2 only) (#2031)

This commit is contained in:
Tom Limoncelli
2023-02-01 07:27:00 -05:00
committed by GitHub
parent bbabf66113
commit de202531cb
12 changed files with 87 additions and 10 deletions

View File

@@ -1,6 +1,8 @@
package diff
import (
"fmt"
"github.com/StackExchange/dnscontrol/v3/models"
"github.com/StackExchange/dnscontrol/v3/pkg/diff2"
)
@@ -62,6 +64,9 @@ func (d *differCompat) IncrementalDiff(existing []*models.RecordConfig) (unchang
for _, inst := range instructions {
cor := Correlation{d: d.OldDiffer}
switch inst.Type {
case diff2.REPORT:
// Sadly the NewCompat function doesn't have a way to do this.
// Purge reports are silently skipped.
case diff2.CREATE:
cor.Desired = inst.New[0]
create = append(create, cor)
@@ -72,6 +77,8 @@ func (d *differCompat) IncrementalDiff(existing []*models.RecordConfig) (unchang
case diff2.DELETE:
cor.Existing = inst.Old[0]
toDelete = append(toDelete, cor)
default:
panic(fmt.Sprintf("unhandled inst.Type %s", inst.Type))
}
}