Bug 868649 - rhevm-shell bogus behavior with -h flag and with wrong arguments
rhevm-shell bogus behavior with -h flag and with wrong arguments
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-cli (Show other bugs)
3.1.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michael Pasternak
Ilia Meerovich
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-21 09:03 EDT by Ilia Meerovich
Modified: 2016-07-04 20:06 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-10-21 09:55:01 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ilia Meerovich 2012-10-21 09:03:22 EDT
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 09:11:29 EDT
> 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 09:40:35 EDT
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 09:43:31 EDT
also you have a bug in help message: "connect to a oVirt manager",
should be RHEVM manager
Comment 4 Itamar Heim 2012-10-21 09:45:09 EDT
actually, should probably be oVirt Engine?
Comment 5 Michael Pasternak 2012-10-21 09:53:59 EDT
(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 09:56:18 EDT
(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)

Note You need to log in before you can comment on or make changes to this bug.