Bug 1155003

Summary: Should prompt correct and important parameter information when use none or error parameter in "rhc server add" command
Product: OpenShift Container Platform Reporter: wangyanyan <yanywang>
Component: ocAssignee: Rory Thrasher <rthrashe>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 2.2.0CC: adellape, bleanhar, jialiu, jokerman, libra-onpremise-devel, mmccomas, rthrashe, tiwillia, xtian, yanpzhan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhc-1.38.4.1-1.el6op Doc Type: Bug Fix
Doc Text:
The `rhc server add` command was previously missing the `[--ssl-client-key-file FILE]` option in its summary and `--help` responses. The command also requires all three arguments (`[--ssl-ca-file FILE]`, `[--ssl-client-cert-file FILE]`, and `[--ssl-client-key-file FILE]`) in order to properly allow `rhc server add` to use the certificate information. However, there was no error message to inform the user when only one or two of the options were present. This was causing confusion on the proper way to use SSL certificate information with this command. This bug fix updates the usage statements for the `rhc server add` command to now include `[--ssl-client-key-file FILE]` in their argument list. There is also a check for when users included only one or two files, which will properly inform the user that all one commands are required. This should reduce confusion and provide much better feedback on the usage of the `rhc server add` command.
Story Points: ---
Clone Of:
: 1155345 1155347 (view as bug list) Environment:
Last Closed: 2015-12-17 17:09:42 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:
Bug Depends On: 1155347    
Bug Blocks: 1155345    

Description wangyanyan 2014-10-21 08:39:37 UTC
Description of problem:
When missing some required parameter or error parameter in use "rhc server add" command, it prompt incorrect information

Version-Release number of selected component (if applicable):
ose2.2/2014-19.1
rhc 1.31.2.1

How reproducible:
Always

Steps to Reproduce:
1.rhc server add
2.rhc server add broker.ose222.example.com --ssl-ca-file ./ca.crt --ssl-client-cert-file ./yanywang2.crt

Actual results:
1.# rhc server add
Missing required argument 'hostname'.
Usage: rhc server-add <hostname> [<nickname>] [--rhlogin LOGIN]
[--[no-]use-authorization-tokens] [--[no-]insecure] [--use] [--skip-wizard]
[--timeout SECONDS] [--ssl-ca-file FILE] [--ssl-client-cert-file FILE]
[--ssl-version VERSION]
Pass '--help' to see the full list of options
2.# rhc server add broker.ose222.example.com --ssl-ca-file ./ca.crt --ssl-client-cert-file ./yanywang2.crt 
You are not authorized to perform this operation.

Expected results:
1.Should prompt correct and important parameter like help options.
--ssl-client-key-file parameter missing
2.Should tell user missing --ssl-client-key-file parameter


Additional info:

Comment 3 openshift-github-bot 2015-10-26 18:36:37 UTC
Commits pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/04fd726c2974706aa1812f2ebb0530222f8868b4
server.rb: fixes incorrect error output and additional input validation

Bug 1155003
Bugzilla link https://bugzilla.redhat.com/show_bug.cgi?id=1155003
Changes usage messages to include --ssl-client-key-file option, which was previously missing.

The rhc server add command also requires all three of --ssl-ca-file, --ssl-client-cert-file, and ssl-client-key-file and will now raise an error if only 1 or 2 of the 3 are present.  Adds corresponding spec test.

https://github.com/openshift/rhc/commit/69a2fcebc3ce274851aed229be8c65c45bdc45eb
Merge pull request #707 from thrasher-redhat/bug1155003

Merged by openshift-bot

Comment 6 Yanping Zhang 2015-11-12 11:00:38 UTC
Verified on latest puddle: OpenShiftEnterpriseErrata/2.2/2015-11-11.1
# rpm -qa|grep rhc
rhc-1.38.4.1-1.el6op.noarch

Steps to verify:
1.Check the help info for server add, there is option --ssl-client-key-file now.
# rhc server add -h
--ssl-client-key-file FILE An RSA client certificate key
2.When providing 1 or 2 options of the 3 options:--ssl-ca-file, --ssl-client-cert-file, and --ssl-client-key-file , there will be error info shown up.
2.1 # rhc server add  broker.ose22-auto.com.cn --ssl-ca-file /tmp/ca.crt 
You must use the --ssl-ca-file, --ssl-client-cert-file, and --ssl-client-key-file commands together.
Usage: rhc server-add <hostname> [<nickname>] [--rhlogin LOGIN] [--[no-]use-authorization-tokens]
[--[no-]insecure] [--use] [--skip-wizard] [--timeout SECONDS] [--ssl-ca-file FILE]
[--ssl-client-cert-file FILE] [--ssl-client-key-file FILE] [--ssl-version VERSION]
Pass '--help' to see the full list of options
2.2 # rhc server add  broker.ose22-auto.com.cn --ssl-ca-file /tmp/ca.crt --ssl-client-cert-file /tmp/ca2.crt 
You must use the --ssl-ca-file, --ssl-client-cert-file, and --ssl-client-key-file commands together.
Usage: rhc server-add <hostname> [<nickname>] [--rhlogin LOGIN] [--[no-]use-authorization-tokens]
[--[no-]insecure] [--use] [--skip-wizard] [--timeout SECONDS] [--ssl-ca-file FILE]
[--ssl-client-cert-file FILE] [--ssl-client-key-file FILE] [--ssl-version VERSION]
Pass '--help' to see the full list of options
2.3 # rhc server add  broker.ose22-auto.com.cn --ssl-ca-file /tmp/ca.crt --ssl-client-key-file  .ssh/id_rsa
You must use the --ssl-ca-file, --ssl-client-cert-file, and --ssl-client-key-file commands together.
Usage: rhc server-add <hostname> [<nickname>] [--rhlogin LOGIN] [--[no-]use-authorization-tokens]
[--[no-]insecure] [--use] [--skip-wizard] [--timeout SECONDS] [--ssl-ca-file FILE]
[--ssl-client-cert-file FILE] [--ssl-client-key-file FILE] [--ssl-version VERSION]
Pass '--help' to see the full list of options

The bug is fixed, so move it to Verified.

Comment 8 errata-xmlrpc 2015-12-17 17:09:42 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://rhn.redhat.com/errata/RHSA-2015-2666.html