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

replace error type assertions with errors.As() in the destroy module #3971

Merged
merged 1 commit into from Aug 5, 2020

Conversation

Fedosin
Copy link
Contributor

@Fedosin Fedosin commented Jul 29, 2020

No description provided.

@Fedosin
Copy link
Contributor Author

Fedosin commented Jul 29, 2020

/label platform/openstack

@Fedosin Fedosin changed the title replace error type assertions with errors.As() replace error type assertions with errors.As() in the destroy module Jul 29, 2020
@mandre
Copy link
Member

mandre commented Jul 29, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 29, 2020
@@ -224,7 +224,8 @@ func deleteServers(opts *clientconfig.ClientOpts, filter Filter, logger logrus.F
err = servers.Delete(conn, server.ID).ExtractErr()
if err != nil {
// Ignore the error if the server cannot be found and return with an appropriate message if it's another type of error
if _, ok := err.(gophercloud.ErrDefault404); !ok {
var gerr gophercloud.ErrDefault404
if !errors.As(err, &gerr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are not using gerr here in the if block, isn't it better to use errors.Is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abhinavdahiya
Afaik, errors.Is checks if two errors are equal (i.e. err == gerr), but gophercloud generates new errors of ErrDefault404 type for each request. It means that we have to compare their types (ErrDefault404 or not ErrDefault404).
If you know how I can use errors.Is here, please tell me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think As as is more appropiate, please explain that in the commit message. i'm fine as long as the reasoning is described.

@Fedosin
Copy link
Contributor Author

Fedosin commented Jul 29, 2020

/test e2e-aws-upgrade

@iamemilio
Copy link

can we define var gerr gophercloud.ErrDefault404 as a constant

@iamemilio
Copy link

can we define var gerr gophercloud.ErrDefault404 as a constant

lets do it post ff

@pierreprinetti
Copy link
Member

pierreprinetti commented Aug 1, 2020

can we define var gerr gophercloud.ErrDefault404 as a constant

I'm not sure what you mean. errors.As needs a variable so that it can assign to it

@pierreprinetti
Copy link
Member

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 5, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierreprinetti

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

7 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Aug 5, 2020

@Fedosin: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-metal-ipi 3af06a6 link /test e2e-metal-ipi

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 8031560 into openshift:master Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. platform/openstack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants