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

UPSTREAM: 32722: warn on empty oc get output #10915

Conversation

juanvallejo
Copy link
Contributor

@juanvallejo juanvallejo commented Sep 14, 2016

UPSTREAM: kubernetes/kubernetes#32722

Fixes: #10285
Related Trello Card:
https://trello.com/c/04lpfTQR/451-8-cli-improved-flows-and-ux-in-the-cli-evg-ux-p3

The current default behavior of oc get is to return an empty
output when there are no resources to display. This patch improves
usability by returning a warning through stderr in the case of an empty
list.

Before

$ oc get roles
empty output

After

oc get roles

There are no resources to display.

cc @openshift/cli-review

@juanvallejo juanvallejo force-pushed the jvallejo_return-err-on-oc-get-empty-list branch from eee2f49 to fbb8a1f Compare September 14, 2016 21:03

// output empty list warning when no resources to display
if len(infos) == 0 {
fmt.Fprintf(os.Stderr, "%s\n", "There are no resources to display.")
Copy link
Contributor Author

@juanvallejo juanvallejo Sep 14, 2016

Choose a reason for hiding this comment

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

@fabianofranz do you think it would make more sense to output the current namespace / context instead of this? (There are two checkboxes on Trello that ask for more awareness of the current namespace / context and thought this might be a good place to at least partially address those: https://trello.com/c/04lpfTQR/451-8-cli-improved-flows-and-ux-in-the-cli-evg-ux-p3)

EDIT: the new text could read something similar to: "There are no resources to display. You are currently logged in as ... on project ..."

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to print the user, but the namespace seems like a good idea. Even because "user" and "logged in" are not concepts as clear in Kube as they are in Origin, it's more like the session token. Also, remember that "project" is not a concept in Kube, we need to refer to it as "namespaces". So maybe something like

No resources to display in namespace "mynamespace".
No pod(s) to display in namespace "mynamespace".

Resource name might be harder given all, plural/singular etc.

Remember that when running get with flags that filter the result, it may be misguiding to say "no resources" , "no pods", etc; it can give the wrong impression that there are no resources when actually just there aren't resources that match the provided criteria. I'd like to use some wording that makes it clear. Maybe

$ oc get all --selector="app=awesome"
No resources found in namespace "mynamespace" that match your criteria.

Ping @liggitt my Personal Assistant For Grammar Questions™.

Copy link
Member

Choose a reason for hiding this comment

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

Do we refer to them as 'filters' in the flag descriptions? If so I would probably say this instead.

No resources found in namespace "mynamespace" that match your filters.

If the only flag that filters is selector then i'd say

No resources found in namespace "mynamespace" that matches the selector.

But I would only be that specific if we know they used the flag. If this output is in a generic place then be generic and go with criteria or filters.


// output empty list warning when no resources to display
if len(objs) == 0 {
fmt.Fprintf(os.Stderr, "%s\n", "There are no resources to display.")
Copy link
Member

Choose a reason for hiding this comment

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

BTW we need to make sure Stdout, Stderr, etc are passed to commands by the root command and that we use what was passed in every command. The entire CLI structure is pretty screwed in that sense. I'm addressing it in one of my PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll go ahead and pass outErr through the root cmd. Thanks!

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 16, 2016
@juanvallejo juanvallejo force-pushed the jvallejo_return-err-on-oc-get-empty-list branch from 4e00c30 to f19f4ac Compare September 16, 2016 21:47
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 16, 2016
@juanvallejo
Copy link
Contributor Author

Linking @smarterclayton's comment from upstream PR: kubernetes/kubernetes#32722 (comment)

@fabianofranz
Copy link
Member

LGTM, wait for upstream.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 27, 2016
@juanvallejo juanvallejo force-pushed the jvallejo_return-err-on-oc-get-empty-list branch from 2449162 to ec5fdc4 Compare September 27, 2016 17:50
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 27, 2016
@juanvallejo
Copy link
Contributor Author

@fabianofranz upstream merged :) kubernetes/kubernetes#32722 PTAL

@fabianofranz
Copy link
Member

[merge], nice usability improvement.

@juanvallejo juanvallejo force-pushed the jvallejo_return-err-on-oc-get-empty-list branch from ec5fdc4 to fe64e11 Compare October 17, 2016 18:02
@juanvallejo
Copy link
Contributor Author

@fabianofranz test/cmd/sdn.sh is updated now to expect text on "empty" oc get ... output

@fabianofranz
Copy link
Member

@juanvallejo thanks, [merge].

@openshift-bot
Copy link
Contributor

[Test]ing while waiting on the merge queue

@juanvallejo
Copy link
Contributor Author

conformance test flaked on #9548 re[test]

@fabianofranz
Copy link
Member

flaked on #9548 re[merge]

@juanvallejo
Copy link
Contributor Author

@fabianofranz integration test flaked on #9959, conformance had a devicemapper flake #9548

@fabianofranz
Copy link
Member

flaked on #9959 and #9548 re[merge]

@fabianofranz
Copy link
Member

flaked on #11442 re[merge]

@juanvallejo
Copy link
Contributor Author

conformance devicemapper flake #9548

@fabianofranz
Copy link
Member

flaked on #9548 re[merge]

@fabianofranz
Copy link
Member

#8571 re[test] re[merge]

@juanvallejo
Copy link
Contributor Author

conformance devicemapper flake #9548

@fabianofranz
Copy link
Member

flake #9548 re[merge]

@fabianofranz
Copy link
Member

#11560 re[test] re[merge]

@juanvallejo juanvallejo force-pushed the jvallejo_return-err-on-oc-get-empty-list branch from fe64e11 to 6fcec58 Compare October 25, 2016 20:44
@fabianofranz
Copy link
Member

conformance flaked on #10663 re[test] re[merge]

@juanvallejo
Copy link
Contributor Author

conformance test flaked on #9548

@fabianofranz
Copy link
Member

#9548 re[test] re[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Oct 28, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10946/) (Image: devenv-rhel7_5291)

@fabianofranz
Copy link
Member

@juanvallejo I think the latest conformance error might be legitimate. The following bits are expecting an empty output (which they'll never get):

https://github.com/openshift/origin/blob/master/test/extended/builds/remove_buildconfig.go#L48-L53

@juanvallejo
Copy link
Contributor Author

@fabianofranz Thanks! I will take a look

@juanvallejo juanvallejo force-pushed the jvallejo_return-err-on-oc-get-empty-list branch 2 times, most recently from 55a9ce0 to 8cc4387 Compare October 31, 2016 14:02
Fixes: openshift#10285
Related Trello Card:
https://trello.com/c/04lpfTQR/451-8-cli-improved-flows-and-ux-in-the-cli-evg-ux-p3

The current default behavior of `oc get` is to return an empty
output when there are no resources to display. This patch improves
usability by returning a warning through stderr in the case of an empty
list.
@juanvallejo juanvallejo force-pushed the jvallejo_return-err-on-oc-get-empty-list branch from 8cc4387 to 26083d5 Compare November 1, 2016 13:38
@juanvallejo
Copy link
Contributor Author

@fabianofranz The test keeps failing here but I am not sure if this is due to a change I made in this PR, or if it's just a flake

@juanvallejo
Copy link
Contributor Author

conformance flaked on #11661 re[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 26083d5

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10946/) (Base Commit: f55922e)

@fabianofranz
Copy link
Member

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 26083d5

@openshift-bot openshift-bot merged commit 770ba8b into openshift:master Nov 1, 2016
@juanvallejo juanvallejo deleted the jvallejo_return-err-on-oc-get-empty-list branch November 1, 2016 22:44
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.

4 participants