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

Allow for response errors to be passed back from a plugin #3412

Merged
merged 3 commits into from
Oct 6, 2017

Conversation

briankassouf
Copy link
Contributor

@briankassouf briankassouf commented Oct 3, 2017

Plugins were previously swallowing the response errors when an error was also returned:

return logical.ErrorResponse("..."), logical.ErrInvalidRequest

@calvn
Copy link
Contributor

calvn commented Oct 3, 2017

Should the same be applied for HandleExistenceCheck()?

@jefferai
Copy link
Member

jefferai commented Oct 3, 2017

^ that -- other than that looks good. Although keep in mind that this may need to be applied to the persona lookahead once that is on this side of things, so you may want to do that as a followup on the other side so it doesn't get lost.

@briankassouf
Copy link
Contributor Author

@jefferai @calvn I believe HandleExistenceCheck is already handling this correctly. Jeff, I'll make a PR for the persona lookahead version.

calvn
calvn previously approved these changes Oct 3, 2017
Copy link
Contributor

@calvn calvn left a comment

Choose a reason for hiding this comment

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

Yea, you're right. Since HandleExistenceCheck doesn't return reply.Response, return false, false, reply.Error should be fine since those would be reply.CheckFound and reply.Exists zero values.

Copy link
Contributor

@calvn calvn left a comment

Choose a reason for hiding this comment

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

The tests are showing that it's returning <nil> string instead of a nil object.

@@ -117,10 +117,9 @@ func (b *backendPluginClient) HandleRequest(req *logical.Request) (*logical.Resp
if reply.Error.Error() == logical.ErrUnsupportedOperation.Error() {
return nil, logical.ErrUnsupportedOperation
}
return nil, reply.Error
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you might need to do return reply.Response, reply.Error here, and keep the other line to explicitly return nil

@briankassouf
Copy link
Contributor Author

@calvn updated, and I tested with the the kubernetes plugin

Copy link
Contributor

@calvn calvn left a comment

Choose a reason for hiding this comment

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

Yep, LGTM!

@briankassouf briankassouf merged commit 9689e88 into master Oct 6, 2017
@briankassouf briankassouf deleted the resp-errors branch October 6, 2017 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants