Bug 1011961

Summary: rct cat-cert should display "Unlimited" for Quantity instead of "-1"
Product: Red Hat Enterprise Linux 6 Reporter: Rehana <redakkan>
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
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Feature: Display Unlimited instead of a -1 for quantity. Reason: The user would be shown a -1 when an entitlement had a quantity of unlimited, this was confusing to the user. Result (if any):
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 21:30:23 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 Rehana 2013-09-25 12:56:22 UTC
Description of problem:
Observed that the Quantity value was displayed as  "-1" instead of 'unlimited' in the entitlement cert

Version-Release number of selected component (if applicable):
subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.28-1
subscription-manager: 1.10.2-1.git.20.340ef28.el7
python-rhsm: 1.10.2-1.git.4.3048ab5.el7


How reproducible:
2/2

Steps to Reproduce:
1.Attach a subscription having "unlimited" available quantity in the machine
2.I have used datacenter sub-pool
3.[root@localhost ~]#  subscription-manager list --available | grep -A9 "dc-virt"
Subscription Name: Awesome OS Server Basic (dc-virt)
SKU:               awesomeos-server-basic-vdc
Pool ID:           8ac6a36241539ee4014153a221bd1437
Available:         10
Suggested:         1
Service Level:     Full-Service
Service Type:      Drive-Through
Multi-Entitlement: No
Ends:              09/25/2014
System Type:       Physical
--
Subscription Name: Awesome OS Server Basic (dc-virt)
SKU:               awesomeos-server-basic-vdc
Pool ID:           8ac6a36241539ee4014153a224ee14d0
Available:         5
Suggested:         1
Service Level:     Full-Service
Service Type:      Drive-Through
Multi-Entitlement: No
Ends:              09/25/2014
System Type:       Physical
--
Subscription Name: Awesome OS Server Basic (dc-virt)
SKU:               awesomeos-server-basic-vdc
Pool ID:           8ac6a36241539ee4014154a3748d164e
Available:         Unlimited
Suggested:         1
Service Level:     Full-Service
Service Type:      Drive-Through
Multi-Entitlement: No
Ends:              09/25/2014
System Type:       Virtual
[root@localhost ~]# subscription-manager attach --pool 8ac6a36241539ee4014154a3748d164e
Successfully attached a subscription for: Awesome OS Server Basic (dc-virt)
[root@localhost ~]# cd /etc/pki/entitlement/
[root@localhost entitlement]# rct cc 390180850599649234.pem | more

+-------------------------------------------+
	Entitlement Certificate
+-------------------------------------------+

Certificate:
	Path: 390180850599649234.pem
	Version: 1.0
	Serial: 390180850599649234
	Start Date: 2013-09-25 00:00:00+00:00
	End Date: 2014-09-25 00:00:00+00:00
	Pool ID: Not Available

Subject:
	CN: 8ac6a36241539ee4014155246c031679

Issuer:
	C: US
	CN: 10.70.35.226
	L: Raleigh

Product:
	ID: 37060
	Name: Awesome OS Server Bits
	Version: 6.1
	Arch: ALL
	Tags: 
	Brand Type: 

Order:
	Name: Awesome OS Server Basic (dc-virt)
	Number: order-8675309
	SKU: awesomeos-server-basic-vdc
	Contract: 0
	Account: 12331131231
	Service Level: Full-Service
	Service Type: Drive-Through
	Quantity: -1  ------> Quantity value in Negative digit
	Quantity Used: 1
	Socket Limit: 2
	RAM Limit: 
	Core Limit: 
	Virt Only: 1
	Subscription: 


Actual results:
Observed that  the Quantity value was displayed as  "-1" instead of 'unlimited' in the entitlement cert

Expected results:
should be displayed as "Unlimited"

Additional info:

pool Details 
 curl -k -u admin:admin https://10.70.35.226:8443/candlepin/pools/8ac6a36241539ee4014155246c031679 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    86    0    86    0     0    225      0 --:--:-- --:--:-- --:--:--   225
{
    "displayMessage": "Pool with id 8ac6a36241539ee4014155246c031679 could not be found."
}
[root@localhost entitlement]# curl -k -u admin:admin https://10.70.35.226:8443/candlepin/pools/8ac6a36241539ee4014154a3748d164e | python -mjson.tool 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4318    0  4318    0     0  18874      0 --:--:-- --:--:-- --:--:-- 19022
{
    "accountNumber": "12331131231",
    "activeSubscription": true,
    "attributes": [
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1650",
            "name": "requires_consumer_type",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "system"
        },
        {
            "created": "2013-09-25T10:21:40.365+0000",
            "id": "8ac6a36241539ee4014154a3748d164f",
            "name": "requires_host",
            "updated": "2013-09-25T10:21:40.365+0000",
            "value": "88d8b6ff-136a-4460-a829-f72ccaf7b684"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1651",
            "name": "source_pool_id",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "8ac6a36241539ee4014153a2235e148c"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1653",
            "name": "pool_derived",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "true"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1652",
            "name": "virt_only",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "true"
        }
    ],
    "calculatedAttributes": {},
    "consumed": 2,
    "contractNumber": "0",
    "created": "2013-09-25T10:21:40.365+0000",
    "derivedProductAttributes": [],
    "derivedProductId": null,
    "derivedProductName": null,
    "derivedProvidedProducts": [],
    "endDate": "2014-09-25T00:00:00.000+0000",
    "exported": 0,
    "href": "/pools/8ac6a36241539ee4014154a3748d164e",
    "id": "8ac6a36241539ee4014154a3748d164e",
    "orderNumber": "order-8675309",
    "owner": {
        "displayName": "Admin Owner",
        "href": "/owners/admin",
        "id": "8ac6a36241539ee40141539f61f20026",
        "key": "admin"
    },
    "productAttributes": [
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1654",
            "name": "support_type",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "Drive-Through"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1655",
            "name": "sockets",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "2"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1656",
            "name": "skip_subs",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "true"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1657",
            "name": "arch",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "x86_64,x86,s390x,ppc64,ia64,arm"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1658",
            "name": "cores",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "4"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e1659",
            "name": "support_level",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "Full-Service"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e165a",
            "name": "ram",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "2"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e165b",
            "name": "variant",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "ALL"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e165c",
            "name": "type",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "MKT"
        },
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e165d",
            "name": "version",
            "productId": "awesomeos-server-basic-vdc",
            "updated": "2013-09-25T10:21:40.366+0000",
            "value": "0.1"
        }
    ],
    "productId": "awesomeos-server-basic-vdc",
    "productName": "Awesome OS Server Basic (dc-virt)",
    "providedProducts": [
        {
            "created": "2013-09-25T10:21:40.366+0000",
            "id": "8ac6a36241539ee4014154a3748e165e",
            "productId": "37060",
            "productName": "Awesome OS Server Bits",
            "updated": "2013-09-25T10:21:40.366+0000"
        }
    ],
    "quantity": -1,
    "restrictedToUsername": null,
    "sourceConsumer": {
        "href": "/consumers/88d8b6ff-136a-4460-a829-f72ccaf7b684",
        "id": "8ac6a36241539ee40141549c8dd015f0",
        "name": "rehanatestmachine.usersys.redhat.com",
        "uuid": "88d8b6ff-136a-4460-a829-f72ccaf7b684"
    },
    "sourceEntitlement": {
        "href": "/entitlements/8ac6a36241539ee4014154a3748c164d",
        "id": "8ac6a36241539ee4014154a3748c164d"
    },
    "sourceStackId": null,
    "startDate": "2013-09-25T00:00:00.000+0000",
    "subscriptionId": "8ac6a36241539ee4014153a0e0670182",
    "subscriptionSubKey": null,
    "updated": "2013-09-25T12:42:32.323+0000"
}

Comment 2 Carter Kozak 2013-09-26 19:53:18 UTC
commit 7554c869608a0276151993d34fee4ddb54185f7a
Author: ckozak <ckozak>
Date:   Wed Sep 25 09:56:52 2013 -0400

    1011961: -1 quantity is printed as unlimited

Comment 5 John Sefler 2013-10-03 23:31:50 UTC
Verifying Version....
[root@jsefler-6 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.28-1
subscription-manager: 1.9.8-1.el6
python-rhsm: 1.9.6-1.el6

[root@jsefler-6 ~]# subscription-manager list --available | grep Unlimited -B4
Subscription Name: Awesome OS with unlimited virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-unlimited
Pool ID:           8a9087404175311a01417531e17d0aca
Available:         Unlimited
--
Subscription Name: Awesome OS with unlimited virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-unlimited
Pool ID:           8a9087404175311a01417531e2430b2c
Available:         Unlimited
[root@jsefler-6 ~]# subscription-manager attach --pool 8a9087404175311a01417531e17d0aca --pool 8a9087404175311a01417531e2430b2c
Successfully attached a subscription for: Awesome OS with unlimited virtual guests
Successfully attached a subscription for: Awesome OS with unlimited virtual guests
[root@jsefler-6 ~]# ls /etc/pki/entitlement/*.pem | grep -v key
/etc/pki/entitlement/1726391033151455130.pem
/etc/pki/entitlement/3560040616902373949.pem
[root@jsefler-6 ~]# rct cat-cert /etc/pki/entitlement/1726391033151455130.pem | grep Order: -A18
Order:
	Name: Awesome OS with unlimited virtual guests
	Number: order-8675309
	SKU: awesomeos-virt-unlimited
	Contract: 0
	Account: 12331131231
	Service Level: 
	Service Type: 
	Quantity: Unlimited        <============= VERIFIED
	Quantity Used: 1
	Socket Limit: 
	RAM Limit: 
	Core Limit: 
	Virt Only: True
	Subscription: 
	Stacking ID: 
	Warning Period: 0
	Provides Management: False

[root@jsefler-6 ~]# rct cat-cert /etc/pki/entitlement/3560040616902373949.pem | grep Order: -A18
Order:
	Name: Awesome OS with unlimited virtual guests
	Number: order-8675309
	SKU: awesomeos-virt-unlimited
	Contract: 1
	Account: 12331131231
	Service Level: 
	Service Type: 
	Quantity: Unlimited        <============= VERIFIED
	Quantity Used: 1
	Socket Limit: 
	RAM Limit: 
	Core Limit: 
	Virt Only: True
	Subscription: 
	Stacking ID: 
	Warning Period: 0
	Provides Management: False

[root@jsefler-6 ~]# 


VERIFIED: rct cat-cert tool now reports the Order quantity from an entitlement granted from a pool with unlimited quantity as "Unlimited" instead of "-1".

Comment 6 errata-xmlrpc 2013-11-21 21:30:23 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