Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 795552

Summary: invalid literal for int() with base 10: 'null'
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3CC: bkearney, jmolet, skallesh, spandey
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:05:55 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: 738066    

Description John Sefler 2012-02-20 21:06:51 UTC
Description of problem:
Encountering the following traceback after consuming an entitlement from a subscription that provides a product with a "null" sockets attribute

2012-02-20 15:29:21,442 [ERROR]  @certmgr.py:131 - Error while updating certificates using daemon
2012-02-20 15:29:21,442 [ERROR]  @certmgr.py:133 - invalid literal for int() with base 10: 'null'
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/certmgr.py", line 124, in <module>
    main(options)
  File "/usr/share/rhsm/subscription_manager/certmgr.py", line 102, in main
    mgr = CertManager(uep=uep)
  File "/usr/share/rhsm/subscription_manager/certmgr.py", line 56, in __init__
    self.healinglib = HealingLib(self.lock, uep=self.uep, facts_dict=facts.to_dict())
  File "/usr/share/rhsm/subscription_manager/facts.py", line 96, in to_dict
    return self.get_facts()
  File "/usr/share/rhsm/subscription_manager/facts.py", line 91, in get_facts
    facts.update(self._get_validity_facts(facts))
  File "/usr/share/rhsm/subscription_manager/facts.py", line 120, in _get_validity_facts
    self.entitlement_dir, facts_dict)
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 109, in __init__
    self._scan_entitlement_certs()
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 223, in _scan_entitlement_certs
    elif not stack_id and not self.ent_cert_sockets_valid(ent_cert):
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 283, in ent_cert_sockets_valid
    sockets_covered = int(ent.getOrder().getSocketLimit())
ValueError: invalid literal for int() with base 10: 'null'




Version-Release number of selected component (if applicable):
[root@jsefler-r63-server ~]# rpm -q subscription-manager
subscription-manager-0.99.7-1.git.5.d9e3ff2.el6.x86_64
[root@jsefler-r63-server ~]# rpm -q python-rhsm
python-rhsm-0.99.3-1.git.3.7ff147a.el6.noarch


How reproducible:

Note that the reproduce steps below come from an automated test that were passing in former releases.  Therefore this bugzilla is a regression.

The reproduce steps below creates products and a subscription subscription that ultimately provides the product whose "sockets" attribute is "null".  After subscribing to the pool, the list --avail command throws a traceback.


Steps to Reproduce:
[root@jsefler-r63-server ~]# curl --insecure --user admin:admin --request POST --data '{"id":"90005","name":"My Awesome OS for \"null\" sockets BITS","attributes":[{"name":"warning_period","value":"30"},{"name":"sockets","value":"null"},{"name":"arch","value":"ALL"},{"name":"type","value":"SVC"},{"name":"variant","value":"workstation"},{"name":"version","value":"0.0"}],"multiplier":1}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/products | python -msimplejson/tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
138   944    0   944    0   300  11748   3733 --:--:-- --:--:-- --:--:-- 64400
{
    "attributes": [
        {
            "created": "2012-02-20T20:36:47.295+0000", 
            "name": "arch", 
            "updated": "2012-02-20T20:36:47.295+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2012-02-20T20:36:47.295+0000", 
            "name": "sockets", 
            "updated": "2012-02-20T20:36:47.295+0000", 
            "value": "null"
        }, 
        {
            "created": "2012-02-20T20:36:47.295+0000", 
            "name": "type", 
            "updated": "2012-02-20T20:36:47.295+0000", 
            "value": "SVC"
        }, 
        {
            "created": "2012-02-20T20:36:47.295+0000", 
            "name": "warning_period", 
            "updated": "2012-02-20T20:36:47.295+0000", 
            "value": "30"
        }, 
        {
            "created": "2012-02-20T20:36:47.295+0000", 
            "name": "version", 
            "updated": "2012-02-20T20:36:47.295+0000", 
            "value": "0.0"
        }, 
        {
            "created": "2012-02-20T20:36:47.295+0000", 
            "name": "variant", 
            "updated": "2012-02-20T20:36:47.295+0000", 
            "value": "workstation"
        }
    ], 
    "created": "2012-02-20T20:36:47.295+0000", 
    "dependentProductIds": [], 
    "href": "/products/90005", 
    "id": "90005", 
    "multiplier": 1, 
    "name": "My Awesome OS for \"null\" sockets BITS", 
    "productContent": [], 
    "updated": "2012-02-20T20:36:47.295+0000"
}

[root@jsefler-r63-server ~]# curl --insecure --user admin:admin --request POST --data '{"id":"my-null-sockets","name":"My Awesome OS for \"null\" sockets","attributes":[{"name":"warning_period","value":"30"},{"name":"sockets","value":"null"},{"name":"arch","value":"ALL"},{"name":"type","value":"MKT"},{"name":"variant","value":"workstation"},{"name":"version","value":"0.0"}],"multiplier":1}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/products | python -m simplejson/tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
140   959    0   959    0   305   1653    526 --:--:-- --:--:-- --:--:--  1348
{
    "attributes": [
        {
            "created": "2012-02-20T20:40:40.019+0000", 
            "name": "arch", 
            "updated": "2012-02-20T20:40:40.019+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2012-02-20T20:40:40.019+0000", 
            "name": "sockets", 
            "updated": "2012-02-20T20:40:40.019+0000", 
            "value": "null"
        }, 
        {
            "created": "2012-02-20T20:40:40.019+0000", 
            "name": "type", 
            "updated": "2012-02-20T20:40:40.019+0000", 
            "value": "MKT"
        }, 
        {
            "created": "2012-02-20T20:40:40.019+0000", 
            "name": "warning_period", 
            "updated": "2012-02-20T20:40:40.019+0000", 
            "value": "30"
        }, 
        {
            "created": "2012-02-20T20:40:40.019+0000", 
            "name": "version", 
            "updated": "2012-02-20T20:40:40.019+0000", 
            "value": "0.0"
        }, 
        {
            "created": "2012-02-20T20:40:40.019+0000", 
            "name": "variant", 
            "updated": "2012-02-20T20:40:40.019+0000", 
            "value": "workstation"
        }
    ], 
    "created": "2012-02-20T20:40:40.019+0000", 
    "dependentProductIds": [], 
    "href": "/products/my-null-sockets", 
    "id": "my-null-sockets", 
    "multiplier": 1, 
    "name": "My Awesome OS for \"null\" sockets", 
    "productContent": [], 
    "updated": "2012-02-20T20:40:40.019+0000"
}

[root@jsefler-r63-server ~]# curl --insecure --user admin:admin --request POST --data '{"product":{"id":"my-null-sockets"},"startDate":"Sun, 19 Feb 2012 15:18:35 -0500","accountNumber":1561247040,"quantity":20,"endDate":"Tue, 6 Mar 2012 15:18:35 -0500","contractNumber":1659237410,"providedProducts":[{"id":"90005"}]}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/owners/admin/subscriptions | python -m simplejson/tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
113  2388    0  2388    0   230  10943   1054 --:--:-- --:--:-- --:--:-- 45914
{
    "accountNumber": "1561247040", 
    "certificate": null, 
    "contractNumber": "1659237410", 
    "created": "2012-02-20T20:46:17.514+0000", 
    "endDate": "2012-03-06T20:18:35.000+0000", 
    "id": "8a90f814359b950f01359c83cbaa148d", 
    "modified": null, 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f814359b950f01359b95533f0007", 
        "key": "admin"
    }, 
    "product": {
        "attributes": [
            {
                "created": "2012-02-20T20:40:40.019+0000", 
                "name": "arch", 
                "updated": "2012-02-20T20:40:40.019+0000", 
                "value": "ALL"
            }, 
            {
                "created": "2012-02-20T20:40:40.019+0000", 
                "name": "sockets", 
                "updated": "2012-02-20T20:40:40.019+0000", 
                "value": "null"
            }, 
            {
                "created": "2012-02-20T20:40:40.019+0000", 
                "name": "type", 
                "updated": "2012-02-20T20:40:40.019+0000", 
                "value": "MKT"
            }, 
            {
                "created": "2012-02-20T20:40:40.019+0000", 
                "name": "warning_period", 
                "updated": "2012-02-20T20:40:40.019+0000", 
                "value": "30"
            }, 
            {
                "created": "2012-02-20T20:40:40.019+0000", 
                "name": "version", 
                "updated": "2012-02-20T20:40:40.019+0000", 
                "value": "0.0"
            }, 
            {
                "created": "2012-02-20T20:40:40.019+0000", 
                "name": "variant", 
                "updated": "2012-02-20T20:40:40.019+0000", 
                "value": "workstation"
            }
        ], 
        "created": "2012-02-20T20:40:40.019+0000", 
        "dependentProductIds": [], 
        "href": "/products/my-null-sockets", 
        "id": "my-null-sockets", 
        "multiplier": 1, 
        "name": "My Awesome OS for \"null\" sockets", 
        "productContent": [], 
        "updated": "2012-02-20T20:40:40.019+0000"
    }, 
    "providedProducts": [
        {
            "attributes": [
                {
                    "created": "2012-02-20T20:36:47.295+0000", 
                    "name": "arch", 
                    "updated": "2012-02-20T20:36:47.295+0000", 
                    "value": "ALL"
                }, 
                {
                    "created": "2012-02-20T20:36:47.295+0000", 
                    "name": "sockets", 
                    "updated": "2012-02-20T20:36:47.295+0000", 
                    "value": "null"
                }, 
                {
                    "created": "2012-02-20T20:36:47.295+0000", 
                    "name": "type", 
                    "updated": "2012-02-20T20:36:47.295+0000", 
                    "value": "SVC"
                }, 
                {
                    "created": "2012-02-20T20:36:47.295+0000", 
                    "name": "warning_period", 
                    "updated": "2012-02-20T20:36:47.295+0000", 
                    "value": "30"
                }, 
                {
                    "created": "2012-02-20T20:36:47.295+0000", 
                    "name": "version", 
                    "updated": "2012-02-20T20:36:47.295+0000", 
                    "value": "0.0"
                }, 
                {
                    "created": "2012-02-20T20:36:47.295+0000", 
                    "name": "variant", 
                    "updated": "2012-02-20T20:36:47.295+0000", 
                    "value": "workstation"
                }
            ], 
            "created": "2012-02-20T20:36:47.295+0000", 
            "dependentProductIds": [], 
            "href": "/products/90005", 
            "id": "90005", 
            "multiplier": 1, 
            "name": "My Awesome OS for \"null\" sockets BITS", 
            "productContent": [], 
            "updated": "2012-02-20T20:36:47.295+0000"
        }
    ], 
    "quantity": 20, 
    "startDate": "2012-02-19T20:18:35.000+0000", 
    "updated": "2012-02-20T20:46:17.514+0000", 
    "upstreamPoolId": null
}

[root@jsefler-r63-server ~]# curl --insecure --user admin:admin --request PUT https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/owners/admin/subscriptions | python -m simplejson/tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
122   366    0   366    0     0   3270      0 --:--:-- --:--:-- --:--:-- 10457
{
    "created": "2012-02-20T20:47:10.347+0000", 
    "finishTime": null, 
    "group": "async group", 
    "id": "refresh_pools_fa43a485-d86e-4823-beaa-62fdbfdd6f7a", 
    "principalName": "admin", 
    "result": null, 
    "startTime": null, 
    "state": "CREATED", 
    "statusPath": "/jobs/refresh_pools_fa43a485-d86e-4823-beaa-62fdbfdd6f7a", 
    "targetId": "admin", 
    "targetType": "owner", 
    "updated": "2012-02-20T20:47:10.347+0000"
}

[root@jsefler-r63-server ~]# subscription-manager list --avail | grep -A1 my-null-sockets
ProductId:            	my-null-sockets          
PoolId:               	8a90f814359b950f01359c84142f148e
[root@jsefler-r63-server ~]# subscription-manager subscribe --pool 8a90f814359b950f01359c84142f148e
Successfully consumed a subscription from the pool with id 8a90f814359b950f01359c84142f148e.
[root@jsefler-r63-server ~]# subscription-manager list --avail
invalid literal for int() with base 10: 'null'


^^^ EXPECTED TO GET A LIST OF AVAILABLE SUBSCRIPTIONS
  
Actual results:


Expected results:


Additional info:

Comment 6 John Sefler 2012-04-10 22:26:34 UTC
Verifying Version....
[root@jsefler-r63-server ~]# rpm -q subscription-manager
subscription-manager-0.99.13-1.el6.x86_64


Note: The fundamental problem in this bug was that the product was created with a "sockets" attribute whose value was a String data type rather than an int.  My verification below whose details are excluded include a product/subscription/pool that are created with a sockets attribute whose value is the String "zero"

[root@jsefler-r63-server ~]# curl --insecure --user admin:admin --stderr /dev/null https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/products/zero-sockets | python -msimplejson/tool
{
    "attributes": [
        {
            "created": "2012-04-10T02:51:24.713+0000", 
            "name": "sockets", 
            "updated": "2012-04-10T02:51:24.713+0000", 
            "value": "zero"
        }, 
        {
            "created": "2012-04-10T02:51:24.714+0000", 
            "name": "arch", 
            "updated": "2012-04-10T02:51:24.714+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2012-04-10T02:51:24.714+0000", 
            "name": "type", 
            "updated": "2012-04-10T02:51:24.714+0000", 
            "value": "MKT"
        }, 
        {
            "created": "2012-04-10T02:51:24.714+0000", 
            "name": "warning_period", 
            "updated": "2012-04-10T02:51:24.714+0000", 
            "value": "30"
        }, 
        {
            "created": "2012-04-10T02:51:24.714+0000", 
            "name": "version", 
            "updated": "2012-04-10T02:51:24.714+0000", 
            "value": "0.0"
        }, 
        {
            "created": "2012-04-10T02:51:24.714+0000", 
            "name": "variant", 
            "updated": "2012-04-10T02:51:24.714+0000", 
            "value": "workstation"
        }
    ], 
    "created": "2012-04-10T02:51:24.713+0000", 
    "dependentProductIds": [], 
    "href": "/products/zero-sockets", 
    "id": "zero-sockets", 
    "multiplier": 1, 
    "name": "Awesome OS for \"zero\" sockets", 
    "productContent": [], 
    "updated": "2012-04-10T02:51:24.713+0000"
}

^^^ NOTICE the sockets attribute is the String "zero".


[root@jsefler-r63-server ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+

Product Name:         	Awesome OS for 0 sockets 
Product Id:           	0-sockets                
Pool Id:              	8a90f8143699934201369a29536652ee
Quantity:             	19                       
Service Level:        	                         
Service Type:        	                         
Multi-Entitlement:    	No                       
Expires:              	04/24/2012               
Machine Type:         	physical                 

Product Name:         	Awesome OS for no sockets
Product Id:           	no-sockets               
Pool Id:              	8a90f8143699934201369a297db65302
Quantity:             	19                       
Service Level:        	                         
Service Type:        	                         
Multi-Entitlement:    	No                       
Expires:              	04/24/2012               
Machine Type:         	physical                 

Product Name:         	Awesome OS for null sockets
Product Id:           	null-sockets             
Pool Id:              	8a90f8143699934201369a29e052532d
Quantity:             	19                       
Service Level:        	                         
Service Type:        	                         
Multi-Entitlement:    	No                       
Expires:              	04/24/2012               
Machine Type:         	physical                 

Product Name:         	Awesome OS for "zero" sockets
Product Id:           	zero-sockets             
Pool Id:              	8a90f8143699934201369a29b1605317
Quantity:             	19                       
Service Level:        	                         
Service Type:        	                         
Multi-Entitlement:    	No                       
Expires:              	04/24/2012               
Machine Type:         	physical                 

[root@jsefler-r63-server ~]# 


^^^ VERIFIED that subscription-manager list --avail does not error with an invalid literal and that the "zero" sockets pool successfully lists as available.  Other variations on a sockets attribute are also available too.

Moving to VERIFIED

Comment 8 errata-xmlrpc 2012-06-20 13:05:55 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-2012-0804.html