mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
MSDNS: be more efficient with ttl changes (#2251)
Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
@@ -265,9 +265,15 @@ func diffTargets(existing, desired []targetConfig) ChangeList {
|
||||
|
||||
m := color.YellowString("± MODIFY %s %s %s", dr.NameFQDN, dr.Type, humanDiff(existing[i], desired[i]))
|
||||
|
||||
instructions = append(instructions,
|
||||
mkChange(dr.NameFQDN, dr.Type, []string{m}, models.Records{er}, models.Records{dr}),
|
||||
)
|
||||
mkc := mkChange(dr.NameFQDN, dr.Type, []string{m}, models.Records{er}, models.Records{dr})
|
||||
if len(existing) == 1 && len(desired) == 1 {
|
||||
// If the tdata has exactly 1 item, drop a hint to the providers.
|
||||
// For example, MSDNS can use a more efficient command if it knows
|
||||
// that `Get-DnsServerResourceRecord -Name FOO -RRType A` will
|
||||
// return exactly one record.
|
||||
mkc.HintRecordSetLen1 = true
|
||||
}
|
||||
instructions = append(instructions, mkc)
|
||||
}
|
||||
|
||||
// any left-over existing are deletes
|
||||
|
@@ -43,6 +43,13 @@ type Change struct {
|
||||
// HintOnlyTTL is true only if (.Type == diff2.CHANGE) && (there is
|
||||
// exactly 1 record being updated) && (the only change is the TTL)
|
||||
HintOnlyTTL bool
|
||||
|
||||
// HintRecordSetLen1 is true only if (.Type == diff2.CHANGE) &&
|
||||
// (there is exactly 1 record at this RecordSet).
|
||||
// For example, MSDNS can use a more efficient command if it knows
|
||||
// that `Get-DnsServerResourceRecord -Name FOO -RRType A` will
|
||||
// return exactly one record.
|
||||
HintRecordSetLen1 bool
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user