When errors occur under `oc` usage info is also being printed. I suspect this is https://github.com/kubernetes/kubernetes/issues/66572 This is a regression in command behavior. We should try to get this fixed in 1.12.
Clayton, could you provide a few commands / scenarios where you are running into this? Is it only when providing extraneous or invalid flags for a command? I can only seem to run into this issue when I specify a flag that does not exist. Additionally, I cannot replicate the issue where we print an error twice (in oc/kubectl).
In a separate discussion, we found out that this is happening on any commands that make use of Cobra's "RunE" instead of "Run". There is an open upstream issue to track this: https://github.com/spf13/cobra/issues/340 A workaround for this would be to set the SilenceUsage field to `true` in the root command, however this silences _all_ usage errors, even the ones we do care about displaying (such as on an invalid flag given). For the time being, we should move away from RunE.
Given that there is a current workaround, which involves moving away from using RunE as mentioned in comment 2, I am lowering the severity of this bug.
The only offender using RunE was removed in the linked PR, upstream is not using RunE anywhere.
Same as comment 1, what were the commands / scenarios hitting the issue? With invalid flag, old and newest oc behave same for me (i.e. prints all --help info): oc new-project --name-invalid-flag my Error: unknown flag: --name-invalid-flag Usage: oc new-project NAME [--display-name=DISPLAYNAME] [--description=DESCRIPTION] [flags] Examples: # 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." Options: --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). BTW, above PR only relates to oc adm release, no fix for other sub commands?
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.
(In reply to Maciej Szulik from comment #10) > There was no actual changes ... OK, thanks for clarifying it. No actual changes seem to also mean no actual verification. > 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 new bug 1748777 to track for future fix of the issue said here.
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:2922