Bug 1920427

Summary: Need to update `oc login` help page since we don't support prompt interactively for the username
Product: OpenShift Container Platform Reporter: zhou ying <yinzhou>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.7CC: aos-bugs, jokerman, mfojtik
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-24 15:56:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhou ying 2021-01-26 10:10:55 UTC
Description of problem:
The `oc login` help show: 
Options:
  -p, --password='': Password, will prompt if not provided
  -u, --username='': Username, will prompt if not provided
But now we don't support prompt interactively for the username. need to update the help page.

Version-Release number of selected component (if applicable):
[zhouying@dhcp-140-138 ~]$ oc version --client
Client Version: 4.7.0-0.nightly-2021-01-22-134922

How reproducible:
always

Steps to Reproduce:
1.`oc help -h` 


Actual results:
[zhouying@dhcp-140-138 ~]$ oc login -h
Log in to your server and save login for subsequent use
....
Options:
  -p, --password='': Password, will prompt if not provided
  -u, --username='': Username, will prompt if not provided


Expected results:
Delete the prompt info for username, since we don't support prompt interactively for it.

Additional info:

Comment 1 zhou ying 2021-01-26 10:23:43 UTC
Also for the description :
 The information required to login -- like username and password, a session token, or the server details -- can be
provided through flags. If not provided, the command will prompt for user input as needed.

Comment 2 Maciej Szulik 2021-01-26 12:44:45 UTC
(In reply to zhou ying from comment #1)
> Also for the description :
>  The information required to login -- like username and password, a session
> token, or the server details -- can be
> provided through flags. If not provided, the command will prompt for user
> input as needed.

That bit doesn't talk about username or password, and that other will be asked for if not provided with --username flag.
We also interactively ask for server URL and inform about certificate, so I'll leave that.

I'll change flag descriptions (both username and password) and fix the interactive example to include --username flag

Comment 4 zhou ying 2021-02-01 04:03:36 UTC
Confirmed with latest oc , the issue has fixed:

[root@dhcp-140-138 ~]# oc login -h
....
Usage:
  oc login [URL] [flags]

Examples:
  # Log in interactively
  oc login --username=myuser
  
  # Log in to the given server with the given certificate authority file
  oc login localhost:8443 --certificate-authority=/path/to/cert.crt
  
  # Log in to the given server with the given credentials (will not prompt interactively)
  oc login localhost:8443 --username=myuser --password=mypass

Options:
  -p, --password='': Password for server
  -u, --username='': Username for server


[root@dhcp-140-138 ~]# oc version --client 
Client Version: 4.7.0-202101300840.p0-ba6a9bd

Comment 7 errata-xmlrpc 2021-02-24 15:56:03 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 (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), 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/RHSA-2020:5633