Bug 1748777 - Usage info is being printed on all errors
Summary: Usage info is being printed on all errors
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.3.0
Assignee: Sally
QA Contact: zhou ying
Depends On:
TreeView+ depends on / blocked
Reported: 2019-09-04 07:42 UTC by Xingxing Xia
Modified: 2020-01-23 11:06 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: full usage menu was printed along with a bad flag error message Consequence: the bad flag error message was being lost because many usage menus are long Fix: only report suggestion to run 'oc command --help' with bad flag error, rather than printing the usage menu Result: user clearly sees the bad flag error message
Clone Of: 1610599
: 1778019 (view as bug list)
Last Closed: 2020-01-23 11:05:47 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github openshift kubernetes-kubectl pull 3 0 'None' 'closed' 'Bug 1748777: kubectl: remove usage info from bad flag error msg' 2019-12-02 17:48:24 UTC
Github openshift oc pull 137 0 'None' 'closed' 'Bug 1748777: bump kubernetes-kubectl' 2019-12-02 17:48:24 UTC
Github openshift oc pull 156 0 'None' 'closed' 'Bug 1748777: oc: don''t print usage info if pass a bad flag, only suggest to pass --help' 2019-12-02 17:48:24 UTC
Red Hat Product Errata RHBA-2020:0062 0 None None None 2020-01-23 11:06:11 UTC

Description Xingxing Xia 2019-09-04 07:42:10 UTC
+++ This bug was initially created as a clone of Bug #1610599 +++

When errors occur under `oc` usage info is also being printed.  I suspect this is https://github.com/kubernetes/kubernetes/issues/66572


--- Additional comment from Maciej Szulik on 2019-09-03 22:49:20 CST ---

There was no actual changes that I'm aware of. The linked PR only fixed the last remaining
element that used RunE. We will be working on fixing the help upstream so that it only 
prints the flag failed w/o full help, but that won't be fixed here.


Using this bug to track future fix for above.

Comment 1 Maciej Szulik 2019-09-04 09:18:02 UTC
Sally, we've talked about upstreaming your effort from https://github.com/soltysh/oc/pull/1
I'd like to see that fixed in 4.3 time frame.

Comment 5 Maciej Szulik 2019-10-10 09:12:45 UTC
This was fixed, but only upstream. We need to pick it back to oc. Sally can you handle that please?

Comment 6 Sally 2019-10-24 19:20:41 UTC
I've opened https://github.com/openshift/kubernetes/pull/94  will bump openshift/oc when that merges.

Comment 8 zhou ying 2019-10-25 07:43:27 UTC
The PR still not merged , change status to POST.

Comment 9 zhou ying 2019-10-25 07:43:35 UTC
The PR still not merged , change status to POST.

Comment 10 Sally 2019-10-31 15:41:21 UTC
I opened https://github.com/openshift/oc/pull/137 to bring in vendored merge (https://github.com/openshift/kubernetes-kubectl/pull/3).  Once oc/pull#137 merges, please verify.  Thanks.

Comment 11 Sally 2019-11-04 15:26:58 UTC
Update: This PR will bring in the fix: https://github.com/openshift/oc/pull/144

Comment 13 zhou ying 2019-11-08 03:14:38 UTC
Confirmed with latest version, the issue still reproduced:
oc extracted from payload: 4.3.0-0.nightly-2019-11-08-015817 which contain the PR: https://github.com/openshift/oc/pull/144. 

[root@dhcp-140-138 oc]# oc adm release info --commits registry.svc.ci.openshift.org/ocp/release:4.3.0-0.nightly-2019-11-08-015817 |grep oc
Pull From: registry.svc.ci.openshift.org/ocp/release@sha256:450cbc23259f04e439e09028a4f20ce118d44a5c14126ef8a3892e73704eabbb
  cli                                           https://github.com/openshift/oc                                            c276ecb733fa3933c5ddcc217d1090cc59ffdd22

root@dhcp-140-138 oc]# git log c276ecb733fa3933c5ddcc217d1090cc59ffdd22|grep "#144"
    Merge pull request #144 from mfojtik/bump-1.16.2

[root@dhcp-140-138 ~]# ./oc new-project ---dadala
Error: bad flag syntax: ---dadala

  oc new-project NAME [--display-name=DISPLAYNAME] [--description=DESCRIPTION] [flags]

  # Create a new project with minimal information
  oc new-project web-team-dev
  # Create a new project with a display name and description
  oc new-project web-team-dev --display-name="Web Team Development" --description="Development project for the web team."

      --description='': Project description
      --display-name='': Project display name
      --skip-config-write=false: If true, the project will not be set as a cluster entry in kubeconfig after being created

Use "oc options" for a list of global command-line options (applies to all commands).

Comment 14 Sally 2019-11-11 13:46:39 UTC
Ah, i see, thanks.  This PR should finally bring in the full (oc + kubectl rather than only kubectl) fix: https://github.com/openshift/oc/pull/156

Comment 15 Maciej Szulik 2019-11-19 20:16:49 UTC
The last PR merged, moving to MODIFIED.

Comment 17 zhou ying 2019-11-20 02:40:46 UTC
confirmed with oc version: 4.3.0-201911190123.git.1.60c4109.el7 , the issue has fixed:

[root@dhcp-140-138 ~]# oc get pppppp
error: the server doesn't have a resource type "pppppp"
[root@dhcp-140-138 ~]# oc new-project --name-invalid-flag my
Error: unknown flag: --name-invalid-flag
See 'oc new-project --help' for usage.

Comment 19 errata-xmlrpc 2020-01-23 11:05:47 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.


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