Skip to content

Commit

Permalink
GCE: Fix spurious comparison failures on adddress & InstanceTemplate
Browse files Browse the repository at this point in the history
Spruce up the find logic to avoid detecting changes that aren't there.
  • Loading branch information
justinsb committed Aug 3, 2020
1 parent 197b6a6 commit 53c464c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions upup/pkg/fi/cloudup/gcetasks/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,22 @@ type Address struct {
ForAPIServer bool
}

var _ fi.CompareWithID = &ForwardingRule{}

func (e *Address) CompareWithID() *string {
return e.Name
}

func (e *Address) Find(c *fi.Context) (*Address, error) {
actual, err := e.find(c.Cloud.(gce.GCECloud))
if actual != nil && err == nil {
if e.IPAddress == nil {
e.IPAddress = actual.IPAddress
}

// Ignore system fields
actual.Lifecycle = e.Lifecycle
actual.ForAPIServer = e.ForAPIServer
}
return actual, err
}
Expand Down
1 change: 1 addition & 0 deletions upup/pkg/fi/cloudup/gcetasks/instancetemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (e *InstanceTemplate) Find(c *fi.Context) (*InstanceTemplate, error) {
for _, scope := range serviceAccount.Scopes {
actual.Scopes = append(actual.Scopes, scopeToShortForm(scope))
}
actual.ServiceAccounts = append(actual.ServiceAccounts, serviceAccount.Email)
}

// When we deal with additional disks (local disks), we'll need to map them like this...
Expand Down

0 comments on commit 53c464c

Please sign in to comment.