Skip to content

Commit

Permalink
exact string match fails, use conventional errors.Is instead
Browse files Browse the repository at this point in the history
Signed-off-by: Furkhat Kasymovgeniiuulu <[email protected]>
  • Loading branch information
furkhat committed Jan 10, 2023
1 parent 067a36e commit 85128fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/cloudprovider/provider/openstack/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ func (p *provider) Cleanup(ctx context.Context, machine *clusterv1alpha1.Machine
return false, osErrorToTerminalError(err, "failed to get compute client")
}

if err := osservers.Delete(computeClient, instance.ID()).ExtractErr(); err != nil && err.Error() != "Resource not found" {
if err := osservers.Delete(computeClient, instance.ID()).ExtractErr(); err != nil && !errors.Is(err, &gophercloud.ErrDefault404{}) {
return false, osErrorToTerminalError(err, "failed to delete instance")
}

Expand Down Expand Up @@ -1034,7 +1034,7 @@ func (p *provider) cleanupFloatingIP(machine *clusterv1alpha1.Machine, updater c
if err != nil {
return fmt.Errorf("failed to create the networkv2 client for region %s: %w", c.Region, err)
}
if err := osfloatingips.Delete(netClient, floatingIPID).ExtractErr(); err != nil && err.Error() != "Resource not found" {
if err := osfloatingips.Delete(netClient, floatingIPID).ExtractErr(); err != nil && !errors.Is(err, &gophercloud.ErrDefault404{}) {
return fmt.Errorf("failed to delete floating ip %s: %w", floatingIPID, err)
}
if err := updater(machine, func(m *clusterv1alpha1.Machine) {
Expand Down

0 comments on commit 85128fb

Please sign in to comment.