Bug 661345

Summary: RHSM gets an index out of bounds exception if used against a single subscription
Product: Red Hat Enterprise Linux 6 Reporter: Bryan Kearney <bkearney>
Component: subscription-managerAssignee: Devan Goodwin <dgoodwin>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: dgoodwin
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:38:02 UTC Type: ---
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: 639436    
Attachments:
Description Flags
Selection of a single available subscription with 1 contract just before clicking "Subscribe" none

Description Bryan Kearney 2010-12-08 16:09:26 UTC
Testing RHSM against the alpha data (rh-alpha-59). The data only has 1 subscription. I see the following exception:


(subscription-manager-gui:10585): libglade-WARNING **: unknown attribute `swapped' for <signal>.
Traceback (most recent call last):
  File "/home/bkearney/code/subscription-manager/src/gui/allsubs.py", line 232, in subscribe_button_clicked
    self._contract_selected(pools.pools[1])
IndexError: list index out of range

Comment 2 Devan Goodwin 2010-12-08 18:10:45 UTC
Cannot reproduce, probably because nothing is showing up as installed on my machine. If I select "provide software not yet installed" I see two subs. 

Could you email me the product cert(s) you have in /etc/pki/product?

Thanks.

Comment 3 Devan Goodwin 2010-12-08 18:37:28 UTC
To reproduce, you need to have only one subscription in the list on the All Subscriptions tab, and then hit the Subscribe button at the bottom.

There were actually about three errors here. First the pool index should be 0, not 1. After this the shortcut to just sub to the only sub available tried to destroy a GUI element that hadn't yet been initialized. Finally it looks like there was a missing return after the shortcut, as the entitlement would be given to the one pool, then we'd still show the contract selection, after which that would fail as you can't bind to the same pool twice. 

All three of these only surface in very specific situation, you must have only one row in your subscription list, and that row must contain only one contract, and you must not have previously opened a contract selector since starting the GUI.

All three fixed in: 571fd4d1ed71a80d62b78c1cff457a34308896b8

Comment 5 Bryan Kearney 2010-12-08 19:57:14 UTC
Verified on my machine.

Comment 6 John Sefler 2010-12-08 23:08:16 UTC
I reproduced the exception against hostname = candlepin1.devlab.phx1.redhat.com with user rh-alpha-99 and the subscription selected as shown in the attached screenshot.
Traceback (most recent call last):
  File "/usr/share/rhsm/gui/allsubs.py", line 232, in subscribe_button_clicked
    self._contract_selected(pools.pools[1])
IndexError: list index out of range

[root@jsefler-onprem02 ~]# rpm -qa | grep subscription-manager
subscription-manager-0.93.2-1.git.91.7f89664.fc14.x86_64
subscription-manager-gnome-0.93.2-1.git.91.7f89664.fc14.x86_64


NOW, I will update to a fixed subscription-manager...

[root@jsefler-onprem02 ~]# rpm -qa | grep subscription-manager
subscription-manager-gnome-0.93.3-1.git.0.a79d99d.fc14.x86_64
subscription-manager-0.93.3-1.git.0.a79d99d.fc14.x86_64

select the same (single subscription with 1 contract) as shown in the screenshot and click Subscribe

SUCCESS!  No traceback and a the subscription appears in "My Subscriptions"

Comment 7 John Sefler 2010-12-08 23:09:59 UTC
Created attachment 467611 [details]
Selection of a single available subscription with 1 contract just before clicking "Subscribe"

Comment 8 John Sefler 2010-12-08 23:11:07 UTC
moving to VERIFIED

Comment 9 errata-xmlrpc 2011-05-19 13:38:02 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0611.html