Bug 1414227 - Error message should be easily detectable for 'oc get'
Summary: Error message should be easily detectable for 'oc get'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 3.11.0
Assignee: Maciej Szulik
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-18 05:47 UTC by Yadan Pei
Modified: 2019-04-11 05:38 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-11 05:38:22 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0636 0 None None None 2019-04-11 05:38:28 UTC

Description Yadan Pei 2017-01-18 05:47:28 UTC
Description of problem:
When run 'oc get' without any resource specified, the error message "error: Required resource not specified" is printed on later part of long output, it's hard to notice this error message
 
Version-Release number of selected component (if applicable):
oc v3.5.0.5+8f2840d
kubernetes v1.5.2+43a9be4

How reproducible:
Always

Steps to Reproduce:
1. Run 'oc get' without resource specified
# oc get 
You must specify the type of resource to get. Valid resource types include:
    * buildconfigs (aka 'bc')
    * builds
    ......
    * thirdpartyresources
    error: Required resource not specified.
Use "oc explain <resource>" for a detailed description of that resource (e.g. oc explain pods).
See 'oc get -h' for help and examples.


Actual results:
1. The error message "error: Required resource not specified" is aligned with resource types


Expected results:
1. The best solution is to put error message 'error: Required resource not specified' at the first line of output(that's before message"You must specify the type of resource....").
Another choice is to remove the space before the message "error: Required resource not specified."in which case the error message is more obvious to notice to match with 3.4.0.39(Output in 3.4.0.39 will be added in Additional info) 


Additional info:
$ oc version
openshift v3.4.0.39
kubernetes v1.4.0+776c994
$ oc get
# oc get 
You must specify the type of resource to get. Valid resource types include:
   ...........
   * users
error: Required resource not specified.
Use "oc explain <resource>" for a detailed description of that resource (e.g. oc explain pods).
See 'oc get -h' for help and examples.

Comment 1 Juan Vallejo 2017-01-25 16:20:05 UTC
Placing the error message near the beginning might make it more difficult to notice than it already is, as a user would have to know to scroll to the beginning of a long output to see it.  I like your idea of removing the space before it. We could do something like:

```
# oc get 
You must specify the type of resource to get. Valid resource types include:
    * buildconfigs (aka 'bc')
    * builds
    ......
    * thirdpartyresources

error: Required resource not specified.
Use "oc explain <resource>" for a detailed description of that resource (e.g. oc explain pods).
See 'oc get -h' for help and examples.
```

WDYT?

Will open PR

Comment 2 Weihua Meng 2017-08-03 09:49:56 UTC
Hi, @yapei, you might miss this.

Comment 3 Yadan Pei 2017-08-08 09:15:42 UTC
Thanks wmeng

@Juan, I'm ok with your solution like this:

```
# oc get 
You must specify the type of resource to get. Valid resource types include:
    * buildconfigs (aka 'bc')
    * builds
    ......
    * thirdpartyresources

error: Required resource not specified.
Use "oc explain <resource>" for a detailed description of that resource (e.g. oc explain pods).
See 'oc get -h' for help and examples.
```

Comment 4 Juan Vallejo 2017-09-13 21:58:50 UTC
Upstream PR: https://github.com/kubernetes/kubernetes/pull/52450

Comment 5 Juan Vallejo 2017-09-25 14:03:10 UTC
Upstream PR has merged [1]. Will be available after next rebase.

1. https://github.com/kubernetes/kubernetes/pull/52450

Comment 7 Maciej Szulik 2019-02-26 15:37:06 UTC
This is available since 3.9, moving to qa.

Comment 8 Yadan Pei 2019-02-28 10:35:02 UTC
# oc version
oc v3.9.71
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server <server>
openshift v3.9.71
kubernetes v1.9.1+a0ce1bc657

# git clone https://github.com/openshift/kubernetes & cd kubernetes
$ git log --pretty="%h %an %cd - %s"  a0ce1bc657 | grep '#52450'      // PR is merged in v3.9.71
4a0f41e4fa Kubernetes Submit Queue Sat Sep 23 18:48:58 2017 -0700 - Merge pull request #52450 from juanvallejo/jvallejo/misc-err-msg-improvements



# oc get
You must specify the type of resource to get. Valid resource types include: 

  * all  
  * buildconfigs (aka 'bc')  
  * builds  
  * certificatesigningrequests (aka 'csr')  
  * clusterrolebindings  
  * clusterroles  
  * componentstatuses (aka 'cs')  
  * configmaps (aka 'cm')  
  * controllerrevisions  
  * cronjobs  
  * customresourcedefinition (aka 'crd')  
  * daemonsets (aka 'ds')  
  * deployments (aka 'deploy')  
  * deploymentconfigs (aka 'dc')  
  * endpoints (aka 'ep')  
  * events (aka 'ev')  
  * horizontalpodautoscalers (aka 'hpa')  
  * imagestreamimages (aka 'isimage')  
  * imagestreams (aka 'is')  
  * imagestreamtags (aka 'istag')  
  * ingresses (aka 'ing')  
  * groups  
  * jobs  
  * limitranges (aka 'limits')  
  * namespaces (aka 'ns')  
  * networkpolicies (aka 'netpol')  
  * nodes (aka 'no')  
  * persistentvolumeclaims (aka 'pvc')  
  * persistentvolumes (aka 'pv')  
  * poddisruptionbudgets (aka 'pdb')  
  * podpreset  
  * pods (aka 'po')  
  * podsecuritypolicies (aka 'psp')  
  * podtemplates  
  * projects  
  * replicasets (aka 'rs')  
  * replicationcontrollers (aka 'rc')  
  * resourcequotas (aka 'quota')  
  * rolebindings  
  * roles  
  * routes  
  * secrets  
  * serviceaccounts (aka 'sa')  
  * services (aka 'svc')  
  * statefulsets (aka 'sts')  
  * storageclasses (aka 'sc')  
  * userserror: Required resource not specified.
Use "oc explain <resource>" for a detailed description of that resource (e.g. oc explain pods).
See 'oc get -h' for help and examples.


We can see that the error message "error: Required resource not specified." is in wrong place(together with the last resource *user), that should not happen

As a conclusion, since fix PR is merged in 3.9.71 but the output still not satisfying, so I'm assigning back

Comment 9 Maciej Szulik 2019-03-01 14:07:57 UTC
I don't think we'll fix that, give the newer versions (starting from 3.11) don't print that list. 
I'm moving the target release to 3.11 in that case.

Comment 10 Yadan Pei 2019-03-04 01:51:00 UTC
# oc get 
You must specify the type of resource to get. Use "oc api-resources" for a complete list of supported resources.

error: Required resource not specified.
Use "oc explain <resource>" for a detailed description of that resource (e.g. oc explain pods).
See 'oc get -h' for help and examples.

oc 3.11.90 doesn't print the resource lists, and the ouput is expected, move to VERIFIED

# oc version
oc v3.11.90
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://<master>
openshift v3.11.88
kubernetes v1.11.0+d4cacc0

Comment 12 errata-xmlrpc 2019-04-11 05:38:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0636


Note You need to log in before you can comment on or make changes to this bug.