Skip to content

Commit

Permalink
Use if rather than if else
Browse files Browse the repository at this point in the history
  • Loading branch information
vcatlassian committed Jun 16, 2023
1 parent 1f22c04 commit c1d3fe7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/controller/cyclenoderequest/transitioner/transitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,14 @@ func (t *CycleNodeRequestTransitioner) transitionHealing() (reconcile.Result, er
// try and re-attach the nodes, if any were un-attached
t.rm.LogEvent(t.cycleNodeRequest, "AttachingNodes", "Attaching instances to nodes group: %v", node.Name)
// if the node is already attached, ignore the error and continue to un-cordoning, otherwise return with error
if alreadyAttached, err := nodeGroups.AttachInstance(node.ProviderID, node.NodeGroupName); alreadyAttached {
alreadyAttached, err := nodeGroups.AttachInstance(node.ProviderID, node.NodeGroupName)
if err != nil && !alreadyAttached {
return t.transitionToFailed(err)
}
if alreadyAttached {
t.rm.LogEvent(t.cycleNodeRequest,
"AttachingNodes", "Skip re-attaching instances to nodes group: %v, err: %v",
node.Name, err)
} else if err != nil {
return t.transitionToFailed(err)
}

// un-cordon after attach as well
Expand Down

0 comments on commit c1d3fe7

Please sign in to comment.