Skip to content

Commit

Permalink
Revert "fix: New provider specific update"
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffo authored Nov 29, 2022
1 parent f1d37ea commit 82a554e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,16 @@ func shouldUpdateTTL(desired, current *endpoint.Endpoint) bool {
}

func (p *Plan) shouldUpdateProviderSpecific(desired, current *endpoint.Endpoint) bool {
currentProperties := map[string]endpoint.ProviderSpecificProperty{}

if current.ProviderSpecific != nil {
for _, d := range current.ProviderSpecific {
currentProperties[d.Name] = d
}
}
desiredProperties := map[string]endpoint.ProviderSpecificProperty{}

if desired.ProviderSpecific != nil {
for _, d := range desired.ProviderSpecific {
if c, ok := currentProperties[d.Name]; ok {
desiredProperties[d.Name] = d
}
}
if current.ProviderSpecific != nil {
for _, c := range current.ProviderSpecific {
if d, ok := desiredProperties[c.Name]; ok {
if p.PropertyComparator != nil {
if !p.PropertyComparator(c.Name, c.Value, d.Value) {
return true
Expand All @@ -229,10 +228,10 @@ func (p *Plan) shouldUpdateProviderSpecific(desired, current *endpoint.Endpoint)
}
} else {
if p.PropertyComparator != nil {
if !p.PropertyComparator(c.Name, "", d.Value) {
if !p.PropertyComparator(c.Name, c.Value, "") {
return true
}
} else if d.Value != "" {
} else if c.Value != "" {
return true
}
}
Expand Down

0 comments on commit 82a554e

Please sign in to comment.