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

Shorten code by using ParseAddrs #4546

Merged
merged 2 commits into from
May 10, 2018
Merged

Conversation

tyrannosaurus-becks
Copy link
Contributor

No description provided.

jefferai
jefferai previously approved these changes May 10, 2018
@jefferai jefferai added this to the 0.10.2 milestone May 10, 2018
briankassouf
briankassouf previously approved these changes May 10, 2018
parsedCIDRs = append(parsedCIDRs, &sockaddr.SockAddrMarshaler{parsedCIDR})
parsedCIDRs, err := parseutil.ParseAddrs(d.Get("bound_cidrs"))
if err != nil {
return logical.ErrorResponse(err.Error()), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

This should still return logical.ErrInvalidRequest

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my oversight!

I don't think it would default to ErrInvalidRequest because here it's under a case statement rather than a default. https://github.com/hashicorp/vault/blob/master/logical/response_util.go#L106

Copy link
Member

Choose a reason for hiding this comment

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

It would, because it starts at ErrInvalidRequest. If nothing modifies it, it will stay there. Since in this case nothing is modifying it...

@tyrannosaurus-becks tyrannosaurus-becks dismissed stale reviews from briankassouf and jefferai via 977e2d4 May 10, 2018 20:20
@tyrannosaurus-becks tyrannosaurus-becks merged commit 5f342b4 into master May 10, 2018
@tyrannosaurus-becks tyrannosaurus-becks deleted the use-parse-addrs branch May 10, 2018 20: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