Hide Forgot
Description of problem: Message from oadm (or oc adm) with --request-timeout needs not the info of help cmd. Message from oc with --request-timeout just has no that info, except `oc adm`. Version-Release number of selected component (if applicable): openshift/oc v1.4.0-alpha.0+28ae87f How reproducible: Always Steps to Reproduce: 1. $ oc get pod --request-timeout=1ms 2. $ oadm policy remove-role-from-user admin star --request-timeout=1ms 3. Actual results: Both oc and oadm can shows the timeout info: error: Get https://<master>:8443/api: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) But oadm has one extra line: See 'oadm ... -h' for help and examples. Expected results: That help cmd info is not related to timeout error and thus not needed. Additional info:
The reason why you are seeing this additional error (See 'oadm ... -h' ...) after _some_ `oadm` sub-commands is because they pass any errors they receive through CheckErr(UsageErr(err)) https://github.com/openshift/origin/blob/master/pkg/cmd/admin/policy/modify_roles.go#L137 This is not limited to just `oadm` commands, several `oc` commands such as `oc policy` do this as well: ``` $ oc policy can-i list pods --request-timeout=1ms error: Get https://10.13.137.149:8443/api: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) See 'oc policy can-i -h' for help and examples. ``` A solution to this would be to type the request timeout error, go through every sub-command in the command tree that returns a `UsageError` on failure, and update it so that the `UsageError` is returned in each of its helper functions instead (but only if the error is not of the new request timeout error type), rather than having the UsageError return in the command's `Run` function. I am not sure how feasible this would be.
At least as of v3.7, executing the command from comment 0 [1] no longer displays help info: [1] ``` $ oadm policy remove-role-from-user admin star --request-timeout=1ms Unable to connect to the server: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) ```
Indeed in v3.7 (oadm v3.7.0-0.181.0) the unrelated "See 'oadm ... -h' for help and examples" is not shown. (oadm v3.6.173.0.56 still shows)