Bug 868649

Summary: rhevm-shell bogus behavior with -h flag and with wrong arguments
Product: Red Hat Enterprise Virtualization Manager Reporter: Ilia Meerovich <iliam>
Component: ovirt-engine-cliAssignee: Michael Pasternak <mpastern>
Status: CLOSED NOTABUG QA Contact: Ilia Meerovich <iliam>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: bazulay, dyasny, ecohen, edolinin, iheim, oramraz, Rhev-m-bugs, ykaul
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-21 13:55:01 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 Ilia Meerovich 2012-10-21 13:03:22 UTC
Description of problem:
Not user friendly way of work.
CLI should show help in first case and show error message and help in second example.
 
Version-Release number of selected component (if applicable):
rhevm-cli-3.1.0.17-1.el6ev.noarch

How reproducible:
Deterministic

Steps to Reproduce and actual results:
[imeerovi@imeerovi ART]$ rhevm-shell  -c -l moo -u boo  -h "This is bug - help should work, no "Password:" stuff should appear" 
Password: 
Usage: rhevm-shell [options]
       rhevm-shell [options] command...

This program is a command-line interface to RHEVM Virtualization.

Options:
  -h, --help            show this help message and exit
  -d, --debug           enable debugging
  -l URL, --url=URL     specifies the API entry point URL
                        (http[s]://server[:port]/api)
  -u USERNAME, --username=USERNAME
                        connect as this user
  -K KEY_FILE, --key-file=KEY_FILE
                        specify client PEM key-file
  -C CERT_FILE, --cert-file=CERT_FILE
                        specify client PEM cert-file
  -A CA_FILE, --ca-file=CA_FILE
                        specify server CA cert-file
  -I, --insecure        allow connecting to SSL sites without certificates
  -F, --filter          enables user permission based filtering
  -P PORT, --port=PORT  specify port
  -T TIMEOUT, --timeout=TIMEOUT
                        specify timeout
  -c, --connect         automatically connect
  -f FILE, --file=FILE  read commands from FILE instead of stdin
[imeerovi@imeerovi ART]$ 

Expected results:
Help message, no "Password:" prompt and waiting for password

For this error:
[imeerovi@imeerovi ART]$ rhevm-shell  -c -l moo -u boo "This is bug - cli shuold show now error message" 
Password: 


error: wrong number of arguments, try 'help connect' for help.


        
 ++++++++++++++++++++++++++++++++++++++++++
 
           Welcome to RHEVM shell
 
 ++++++++++++++++++++++++++++++++++++++++++
        
    
[RHEVM shell (disconnected)]# exit


Expected results:
error message and help message, no login 

Additional info:

Comment 1 Michael Pasternak 2012-10-21 13:11:29 UTC
> Steps to Reproduce and actual results:
> [imeerovi@imeerovi ART]$ rhevm-shell  -c -l moo -u boo  -h "This is bug -
> help should work, no "Password:" stuff should appear" 

you using shell incorrectly, when you aim to see help, you should not
supply options, i.e rhevm-shell -h or rhevm-shell --help, otherwise you
trying to login ...

> Password: 
> Usage: rhevm-shell [options]
>        rhevm-shell [options] command...
> 
> This program is a command-line interface to RHEVM Virtualization.
> 
> Options:
>   -h, --help            show this help message and exit
>   -d, --debug           enable debugging
>   -l URL, --url=URL     specifies the API entry point URL
>                         (http[s]://server[:port]/api)
>   -u USERNAME, --username=USERNAME
>                         connect as this user
>   -K KEY_FILE, --key-file=KEY_FILE
>                         specify client PEM key-file
>   -C CERT_FILE, --cert-file=CERT_FILE
>                         specify client PEM cert-file
>   -A CA_FILE, --ca-file=CA_FILE
>                         specify server CA cert-file
>   -I, --insecure        allow connecting to SSL sites without certificates
>   -F, --filter          enables user permission based filtering
>   -P PORT, --port=PORT  specify port
>   -T TIMEOUT, --timeout=TIMEOUT
>                         specify timeout
>   -c, --connect         automatically connect
>   -f FILE, --file=FILE  read commands from FILE instead of stdin
> [imeerovi@imeerovi ART]$ 
> 
> Expected results:
> Help message, no "Password:" prompt and waiting for password
> 
> For this error:
> [imeerovi@imeerovi ART]$ rhevm-shell  -c -l moo -u boo "This is bug - cli
> shuold show now error message" 
> Password: 

parameters/options validated after they been supplied, password is mandatory
option, obviously till all of mandatory options supplied (url/user/password),
no args processing will happen.

> 
> 
> error: wrong number of arguments, try 'help connect' for help.
> 
> 
>         
>  ++++++++++++++++++++++++++++++++++++++++++
>  
>            Welcome to RHEVM shell
>  
>  ++++++++++++++++++++++++++++++++++++++++++
>         
>     
> [RHEVM shell (disconnected)]# exit
> 
> 
> Expected results:
> error message and help message, no login 
> 
> Additional info:

Comment 2 Ilia Meerovich 2012-10-21 13:40:35 UTC
1)From my experience with various shell tools: -h/--help should always work and suppress other flags

2)What is the meaning of disconnected shell? What can user do there if he is not connected?
According to help inside it there are 3 available commands:

AVAILABLE COMMANDS
  
    * connect          connect to a oVirt manager
    * exit             quit this interactive terminal
    * help             show help

Do you want this mode for help reasons?

Comment 3 Ilia Meerovich 2012-10-21 13:43:31 UTC
also you have a bug in help message: "connect to a oVirt manager",
should be RHEVM manager

Comment 4 Itamar Heim 2012-10-21 13:45:09 UTC
actually, should probably be oVirt Engine?

Comment 5 Michael Pasternak 2012-10-21 13:53:59 UTC
(In reply to comment #2)
> 1)From my experience with various shell tools: -h/--help should always work
> and suppress other flags

it's can't be true, options invoked by theirs order, if you would do 
ovirt-shell -h -l -.... it would be the case, 

- i'm using python-opts module which is used by all python apps, and this is by-spec behaviour.

> 
> 2)What is the meaning of disconnected shell? What can user do there if he is
> not connected?
> According to help inside it there are 3 available commands:

of course, read below.

> 
> AVAILABLE COMMANDS
>   
>     * connect          connect to a oVirt manager
>     * exit             quit this interactive terminal
>     * help             show help
> 
> Do you want this mode for help reasons?

exactly, it's there so you can review detail /help for connect command and /connect when you worked out syntax/missing-parameter/etc. issues you had in original command.

Comment 6 Michael Pasternak 2012-10-21 13:56:18 UTC
(In reply to comment #3)
> also you have a bug in help message: "connect to a oVirt manager",
> should be RHEVM manager

make sure you're using latest sdk (this comes from the sdk and already been
fixed)