Skip to content

Commit

Permalink
fix(InstanceExistsByProviderID): handle gobizfly.ErrorNotFound separa…
Browse files Browse the repository at this point in the history
…tely (#48)

* fix(InstanceExistsByProviderID): handle gobizfly.ErrorNotFound separately

* change: reformat code for server.go
  • Loading branch information
chpiano2000 authored Mar 20, 2024
1 parent c2aafa9 commit 42a0022
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cloud-controller-manager/bizfly/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ func (s *servers) InstanceExistsByProviderID(ctx context.Context, providerID str
return false, err
}
server, node, err := serverByID(ctx, s.gclient, serverID)
if errors.Is(err, gobizfly.ErrNotFound) || err != nil {
if errors.Is(err, gobizfly.ErrNotFound) {
return false, nil
}
if err != nil {
return false, err
}
if server != nil || node != nil {
Expand Down Expand Up @@ -241,7 +244,8 @@ func serverByID(
serverError := err
node, err := client.KubernetesEngine.GetEverywhere(ctx, id)
if err != nil {
return nil, nil, fmt.Errorf("error fetching node: %v, and cloud server: %v", serverError, err)
klog.V(5).Infof("error fetching node: %v, and cloud server: %v", serverError, err)
return nil, nil, err
}
return nil, node, nil
}
Expand Down

0 comments on commit 42a0022

Please sign in to comment.