Bug 1001820

Summary: Tab Completion: subscription-manager attach <tab tab>
Product: Red Hat Enterprise Linux 6 Reporter: Sharath Dwaral <fsharath>
Component: subscription-managerAssignee: Carter Kozak <ckozak>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: bkearney, ckozak, jesusr, jgalipea, jmolet, jsefler, redakkan, skallesh, spandey
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: various subscription-manager subcommand auto completion displaying unnecessary characters or incorrect values. Consequence: Fix: Updated the tab completion scripts. Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 21:28:11 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:    
Bug Blocks: 862910    

Description Sharath Dwaral 2013-08-27 20:32:13 UTC
Description of problem:
subscription-manager subscribe - auto completion displaying an unnecessary character 

Version-Release number of selected component (if applicable):
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.23-1
subscription-manager: 1.9.5-1.el6
python-rhsm: 1.9.4-1.el6

How reproducible:
Always

Steps to Reproduce:

# subscription-manager attach <tab tab>
-h               --help           i--auto          --pool           --proxy          --proxypassword  --proxyuser      --quantity       --servicelevel 

# subscription-manager attach --help
Usage: subscription-manager attach [OPTIONS]

Attach a specified subscription to the registered system

Options:
  -h, --help            show this help message and exit
  --proxy=PROXY_URL     proxy URL in the form of proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword=PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --pool=POOL           the ID of the pool to attach (can be specified more
                        than once)
  --quantity=QUANTITY   number of subscriptions to attach
  --auto                automatically attach compatible subscriptions to this
                        system
  --servicelevel=SERVICE_LEVEL
                        service level to apply to this system


Actual results:
Shown Above

Expected results:
Tab completion gives you an option "i--auto" which is not an option as shown in --help (above)

Additional info:

Comment 2 Sharath Dwaral 2013-08-27 21:03:13 UTC
Description:

subscription-manager clean <tab tab> gives you more options which is wrong

Version:

Same as above

Reproducible all the time

# subscription-manager clean -
-h               --help           --proxy          --proxypassword  --proxyuser

Comment 3 Sharath Dwaral 2013-08-28 18:31:44 UTC
More discrepancies 

>>Command option: attach
subsscription-manager attach --pool <tab tab> 
hangs for a few seconds and/or does not display options

>>Command option: config
subsscription-manager config <tab tab> 
displayed with proxy options when it doesn't have any

>>Command option: import
subscription-manager import <tab tab> 
displayed with proxy options when it doesn't have any

>>Command option: list
subscription-manager list <tab tab> 
should not be display "status" as an option

>>Command option: orgs
subscription-manager orgs <tab tab> 
"insecure" and "serverurl" should be displayed as options

>>Command option: plugin
subscription-manager plugin <tab tab> 
displayed with proxy options when it doesn't have any

>>Command option: register
subscription-manager register <tab tab> 
"baseusrl" and "insecure" should be displayed as options

>>Command option: remove
subscription-manager remove serial <tab tab> 
hangs for a few seconds and/or does not display options

>>Command option: service-level
subscription-manager service-level <tab tab> 
"insecure" "username" and "password" should be displayed as options

>>Command option: subscribe
subscription-manager subscribe <tab tab> 
lists "i--auto" instead of "auto" as option

>>Command option: subscribe
subscription-manager subscribe --pool <tab tab> 
hangs for a few seconds and/or does not display options

>>Command option: attach
subscription-manager unsubscribe --serial <tab tab> 
hangs for a few seconds and/or does not display options

Comment 4 Sharath Dwaral 2013-08-28 18:42:02 UTC
>> In tab completion displaying -h or --help option after choosing an option displays differently. This is shown below


# subscription-manager repos <tab tab>
--disable        --enable         -h               --help           --list           --proxy          --proxypassword  --proxyuser

>> Say if i choose an option '--list' and tab complete again i get this

# subscription-manager repos --list -
--disable        --enable         -h               --help           --list           --proxy          --proxypassword  --proxyuser

>> Now choosing '-h' or '--help' will list help menu as shown

# subscription-manager repos --list --h
Usage: subscription-manager repos [OPTIONS]

List the repositories which this system is entitled to use

options:
  -h, --help            show this help message and exit
  --proxy=PROXY_URL     proxy URL in the form of proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword=PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --list                list known repos for this system
  --enable=REPOID       repo to enable (can be specified more than once).
                        Wildcards (* and ?) are supported.
  --disable=REPOID      repo to disable (can be specified more than once).
                        Wildcards (* and ?) are supported

>> choosing '--enable' with -h or --help throws error as shown

 subscription-manager repos --enable --help
Error: --help is not a valid repo ID. Use --list option to see valid repos.

>> The behavior is different. It errors out when the option expects a string value after it and it displays the help menu when it does not expect a string.

Comment 5 Carter Kozak 2013-08-30 13:34:53 UTC
*** Bug 1003010 has been marked as a duplicate of this bug. ***

Comment 6 John Sefler 2013-09-03 21:48:43 UTC
In my opinion, comment 4 is not a bug.

Comment 7 Sharath Dwaral 2013-09-04 13:43:04 UTC
*** Bug 921222 has been marked as a duplicate of this bug. ***

Comment 8 Sharath Dwaral 2013-09-04 13:47:22 UTC
 comment 4 could be ignored because the error message is pretty descriptive.

Comment 9 Carter Kozak 2013-09-11 17:42:46 UTC
commit 2412e8c966d1580dc9f6698b68cbbbb0cfe16e85
Author: ckozak <ckozak>
Date:   Tue Aug 27 17:07:17 2013 -0400

    1001820: fix autocompletion

Comment 11 John Sefler 2013-09-13 18:51:27 UTC
Testing Version...
[root@jsefler-6 ~]# rpm -q subscription-manager bash-completion
subscription-manager-1.9.6-1.el6.x86_64
bash-completion-1.3-7.el6.noarch


[root@jsefler-6 ~]# subscription-manager status --help
Usage: subscription-manager status [OPTIONS]

Show status information for this system's subscriptions and products

Options:
  -h, --help            show this help message and exit
  --proxy=PROXY_URL     proxy URL in the form of proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword=PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --ondate=ON_DATE      future date to check status on, defaults to today's
                        date (example: 2013-09-13)
[root@jsefler-6 ~]# subscription-manager status -<TAB><TAB>
-h               --help           --proxy          --proxypassword  --proxyuser

^^^ BANG! Also expected bash completion option for --ondate

Comment 12 Carter Kozak 2013-09-19 18:36:56 UTC
commit 1a4e71d8bd3ec1bd0faa9bbe166bd83ca09cee8a
Author: Carter Kozak <ckozak>
Date:   Sat Sep 14 10:04:34 2013 -0400

    1001820: added ondate to completion

Comment 13 Bryan Kearney 2013-09-26 18:19:43 UTC
fixed in subscription-manager-1.9.7-1

Comment 14 John Sefler 2013-09-27 16:50:33 UTC
Verifying Version...
[root@jsefler-6 ~]# rpm -q subscription-manager bash-completion
subscription-manager-1.9.7-1.el6.x86_64
bash-completion-1.3-7.el6.noarch

[root@jsefler-6 ~]# subscription-manager status -<TAB><TAB>
-h               --help           --ondate         --proxy          --proxypassword  --proxyuser   


VERIFIED: Option --ondate is now included in the tab completion choices for the status module


QE Note: An automated BashCompletionTests.java has been implemented to assert all of the expected bash completions for subscription-manager module options.

Comment 15 errata-xmlrpc 2013-11-21 21:28:11 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.

http://rhn.redhat.com/errata/RHBA-2013-1659.html