Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exact string match fails, use conventional errors.Is instead #1526

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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