-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
UPSTREAM: 32722: warn on empty oc get output #10915
Conversation
eee2f49
to
fbb8a1f
Compare
|
||
// 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.") |
There was a problem hiding this comment.
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 ..."
There was a problem hiding this comment.
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™.
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
4e00c30
to
f19f4ac
Compare
Linking @smarterclayton's comment from upstream PR: kubernetes/kubernetes#32722 (comment) |
LGTM, wait for upstream. |
2449162
to
ec5fdc4
Compare
@fabianofranz upstream merged :) kubernetes/kubernetes#32722 PTAL |
[merge], nice usability improvement. |
ec5fdc4
to
fe64e11
Compare
@fabianofranz test/cmd/sdn.sh is updated now to expect text on "empty" |
@juanvallejo thanks, [merge]. |
[Test]ing while waiting on the merge queue |
conformance test flaked on #9548 re[test] |
flaked on #9548 re[merge] |
@fabianofranz integration test flaked on #9959, conformance had a devicemapper flake #9548 |
flaked on #11442 re[merge] |
conformance devicemapper flake #9548 |
flaked on #9548 re[merge] |
#8571 re[test] re[merge] |
conformance devicemapper flake #9548 |
flake #9548 re[merge] |
#11560 re[test] re[merge] |
fe64e11
to
6fcec58
Compare
conformance flaked on #10663 re[test] re[merge] |
conformance test flaked on #9548 |
#9548 re[test] re[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10946/) (Image: devenv-rhel7_5291) |
@juanvallejo I think the latest conformance error might be legitimate. The following bits are expecting an empty output (which they'll never get): |
@fabianofranz Thanks! I will take a look |
55a9ce0
to
8cc4387
Compare
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.
8cc4387
to
26083d5
Compare
@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 |
conformance flaked on #11661 re[test] |
Evaluated for origin test up to 26083d5 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10946/) (Base Commit: f55922e) |
[merge] |
Evaluated for origin merge up to 26083d5 |
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 emptyoutput 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
cc @openshift/cli-review