Fix TXT record planning.

This commit is contained in:
John Chadwick 2018-06-01 09:00:27 -04:00
parent 522107696d
commit d934f693ff

View File

@ -131,10 +131,10 @@ func (t planTable) getDeletes() (deleteList []*endpoint.Endpoint) {
func (p *Plan) Calculate() *Plan { func (p *Plan) Calculate() *Plan {
t := newPlanTable() t := newPlanTable()
for _, current := range p.Current { for _, current := range filterRecordsForPlan(p.Current) {
t.addCurrent(current) t.addCurrent(current)
} }
for _, desired := range p.Desired { for _, desired := range filterRecordsForPlan(p.Desired) {
t.addCandidate(desired) t.addCandidate(desired)
} }
@ -175,3 +175,18 @@ func shouldUpdateTTL(desired, current *endpoint.Endpoint) bool {
} }
return desired.RecordTTL != current.RecordTTL return desired.RecordTTL != current.RecordTTL
} }
func filterRecordsForPlan(records []*endpoint.Endpoint) []*endpoint.Endpoint {
filtered := []*endpoint.Endpoint{}
for _, record := range records {
switch record.RecordType {
case endpoint.RecordTypeA, endpoint.RecordTypeCNAME:
filtered = append(filtered, record)
default:
continue
}
}
return filtered
}