Skip to content

Commit

Permalink
exact string match fails, use conventional errors.Is instead (kuberma…
Browse files Browse the repository at this point in the history
…tic#1526)

Signed-off-by: Furkhat Kasymovgeniiuulu <[email protected]>

Signed-off-by: Furkhat Kasymovgeniiuulu <[email protected]>
  • Loading branch information
furkhat authored and multi-io committed Jan 12, 2023
1 parent c91794b commit 3862af1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cloudprovider/provider/openstack/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ func (p *provider) Cleanup(machine *clusterv1alpha1.Machine, data *cloudprovider
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 @@ -1035,8 +1035,8 @@ func (p *provider) cleanupFloatingIP(machine *clusterv1alpha1.Machine, updater c
if err != nil {
return fmt.Errorf("failed to create the networkv2 client for region %s: %v", c.Region, err)
}
if err := osfloatingips.Delete(netClient, floatingIPID).ExtractErr(); err != nil && err.Error() != "Resource not found" {
return fmt.Errorf("failed to delete floating ip %s: %v", floatingIPID, err)
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) {
finalizers := sets.NewString(m.Finalizers...)
Expand Down

0 comments on commit 3862af1

Please sign in to comment.