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

Add source in “error from server” message when using kubectl #10221

Merged

Conversation

feihujiang
Copy link
Contributor

@k8s-bot
Copy link

k8s-bot commented Jun 23, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@@ -97,11 +97,11 @@ func RunCreate(f *cmdutil.Factory, out io.Writer, filenames util.StringList) err
err = r.Visit(func(info *resource.Info) error {
data, err := info.Mapping.Codec.Encode(info.Object)
if err != nil {
return err
return fmt.Errorf("error when creating %q: %v ", info.Source, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be necessary. The error returned here gets handled in CheckErr.

Copy link
Member

Choose a reason for hiding this comment

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

It's not clear to me who calls this and whether or not it's important for these errors to be introspectable.

Copy link
Member

Choose a reason for hiding this comment

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

Well-- this is a public method, so anyone could call it, no? CheckErr isn't guaranteed to be the thing receiving the error?

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically anyone could call it, but in practice it's only ever called in NewCmdCreate and in tests. Come to think of it, all the Run* functions should actually be private.

Copy link
Member

Choose a reason for hiding this comment

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

Well, it's kinda handy to be able to call kubectl functions from e.g. tests, so let's think carefully before we do that... :)

@j3ffml
Copy link
Contributor

j3ffml commented Jun 23, 2015

@k8s-bot ok to test

@j3ffml j3ffml added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jun 23, 2015
@j3ffml j3ffml added this to the v1.0-candidate milestone Jun 23, 2015
@j3ffml
Copy link
Contributor

j3ffml commented Jun 23, 2015

LGTM. Seems like strict improvement to usability.

@@ -65,6 +65,7 @@ type Info struct {
Mapping *meta.RESTMapping
Namespace string
Name string
Source string
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment explaining what "Source" means. Is this the name of a .go file? a .json/.yaml file?

@k8s-bot
Copy link

k8s-bot commented Jun 23, 2015

GCE e2e build/test passed for commit 201c2e7e7322122ffeabf82ba3d8c6e2da5cfe80.

@j3ffml j3ffml assigned lavalamp and unassigned brendandburns Jun 23, 2015
@j3ffml
Copy link
Contributor

j3ffml commented Jun 23, 2015

cc @smarterclayton

@feihujiang feihujiang force-pushed the addSourceForErrorFromServerMessage branch 2 times, most recently from a1d9447 to 41f8830 Compare June 24, 2015 08:42
@k8s-bot
Copy link

k8s-bot commented Jun 24, 2015

GCE e2e build/test failed for commit a1d94473561249d4310bd9433686c1c0b81a1643.

@k8s-bot
Copy link

k8s-bot commented Jun 24, 2015

GCE e2e build/test passed for commit 41f883011949e7e361daa9d058824bbf9c166daf.

@smarterclayton
Copy link
Contributor

LGTM too

@@ -66,6 +66,9 @@ type Info struct {
Namespace string
Name string

//Optional, Source is the filename or URL to template file (.json or .yaml),
//or stdin to use to handle the resource
Copy link
Member

Choose a reason for hiding this comment

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

Nit: A single space after //, please.

@feihujiang feihujiang force-pushed the addSourceForErrorFromServerMessage branch from 41f8830 to 54fb8c6 Compare June 25, 2015 06:15
@feihujiang feihujiang force-pushed the addSourceForErrorFromServerMessage branch from 54fb8c6 to b41b531 Compare June 25, 2015 06:23
@feihujiang
Copy link
Contributor Author

@lavalamp I updated according to your advice, Could you please review this PR again?

@lavalamp
Copy link
Member

LGTM

@lavalamp
Copy link
Member

@dchen1107 for ok-to-merge?

@dchen1107 dchen1107 removed this from the v1.0-candidate milestone Jun 25, 2015
@dchen1107
Copy link
Member

LGTM

mbforbes added a commit that referenced this pull request Jun 25, 2015
…Message

Add source in “error from server” message when using kubectl
@mbforbes mbforbes merged commit d90895a into kubernetes:master Jun 25, 2015
@feihujiang feihujiang deleted the addSourceForErrorFromServerMessage branch September 11, 2015 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants