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

Pass ctx to Validate, ValidateUpdate #6163

Merged
merged 1 commit into from
Mar 30, 2015

Conversation

ncdc
Copy link
Member

@ncdc ncdc commented Mar 30, 2015

Pass ctx to Validate/ValidateUpdate. This is useful so strategies can
access data such as the current user.

@googlebot
Copy link

Thanks for your pull request.

It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/.

If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits.

Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name.

@ncdc
Copy link
Member Author

ncdc commented Mar 30, 2015

@smarterclayton @thockin PTAL

@vmarmol
Copy link
Contributor

vmarmol commented Mar 30, 2015

Assigning to @smarterclayton, feel free to re-assign.

@ncdc
Copy link
Member Author

ncdc commented Mar 30, 2015

@smarterclayton actually, now that I look at the function signature, since PrepareForCreate/Update doesn't return anything right now, we won't be able to stop a create/update from proceeding when there's a referential integrity issue (i.e. not authorized for Bob to access Alice's ImageStream).

@ncdc
Copy link
Member Author

ncdc commented Mar 30, 2015

Does it make sense to have these methods return a ValidationErrorList? or an error?

@smarterclayton
Copy link
Contributor

Maybe an error. However, that gets into the question of why wouldn't this then be folded into Validate, where there is just two parts of validation in the strategy - inherent, and referential.

@smarterclayton
Copy link
Contributor

Having Prepare* return an error seems to just be duplicating Validate*

@ncdc
Copy link
Member Author

ncdc commented Mar 30, 2015

I thought you had said you didn't want to do referential integrity checking in the Validate* methods. I'm quite happy to modify Validate and ValidateUpdate to take in the ctx instead.

@smarterclayton
Copy link
Contributor

Not the core Validate methods - the Strategy validate methods.

On Mar 30, 2015, at 1:19 PM, Andy Goldstein notifications@github.com wrote:

I thought you had said you didn't want to do referential integrity checking in the Validate* methods. I'm quite happy to modify Validate and ValidateUpdate to take in the ctx instead.


Reply to this email directly or view it on GitHub.

@ncdc ncdc force-pushed the add-ctx-to-rest-prepare branch from 6bfb01f to 51bdbe0 Compare March 30, 2015 17:51
@ncdc ncdc changed the title Pass ctx to PrepareForCreate/Update Pass ctx to Validate, ValidateUpdate Mar 30, 2015
@ncdc
Copy link
Member Author

ncdc commented Mar 30, 2015

@smarterclayton updated to pass ctx to the Validate* strategy methods

ncdc pushed a commit to ncdc/origin that referenced this pull request Mar 30, 2015
@@ -19,6 +19,8 @@ package controller
import (
"fmt"

"strconv"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nuke the whitespace above this

Copy link
Member Author

Choose a reason for hiding this comment

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

That's from goimports, but ok

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@smarterclayton
Copy link
Contributor

After you fix that one line LGTM

Pass ctx to Validate/ValidateUpdate. This is useful so strategies can
access data such as the current user.
@ncdc ncdc force-pushed the add-ctx-to-rest-prepare branch from 51bdbe0 to d7c5f42 Compare March 30, 2015 21:33
@smarterclayton
Copy link
Contributor

Goimports isn't smart enough to know that "fmt" and "strconv" are in the same group, it just knows that strconv doesn't belong with the deeply nested types.

@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 30, 2015
smarterclayton added a commit that referenced this pull request Mar 30, 2015
Pass ctx to Validate, ValidateUpdate
@smarterclayton smarterclayton merged commit 1dc895e into kubernetes:master Mar 30, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Mar 31, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Mar 31, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Mar 31, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Apr 1, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Apr 1, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Apr 2, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Apr 2, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Apr 2, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Apr 2, 2015
ncdc pushed a commit to ncdc/origin that referenced this pull request Apr 2, 2015
@ncdc ncdc deleted the add-ctx-to-rest-prepare branch February 13, 2017 17:25
@ncdc ncdc restored the add-ctx-to-rest-prepare branch February 13, 2017 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants