Bug 729070 - adding pools to an activation key should be blocked when specifying a quantity>1 for a non-multi-entitlement pool
Summary: adding pools to an activation key should be blocked when specifying a quantit...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: Unspecified
OS: Solaris
unspecified
medium
Target Milestone: ---
: ---
Assignee: William Poteat
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-08-08 16:33 UTC by John Sefler
Modified: 2015-05-14 15:23 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-30 13:15:32 UTC


Attachments (Terms of Use)

Description John Sefler 2011-08-08 16:33:40 UTC
Description of problem:
When adding pools to an activation key, you can specify a quantity=# as a parameter.  Currently candlepin is allowing me to specify a quantity>1 with non-multi-entitlement pools.  As a result, registration with this activation key is appropriately failing.  We should probably block this condition at the time the pool is added to the key.  Otherwise we are successfully creating keys that are doomed to fail during registration.


Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62candlepin proxy]# git branch
* master
[root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master
895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/heads/master
895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/remotes/origin/master


How reproducible:


Steps to Reproduce:
Find a non-multi-entitlement pool...
[root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --org=admin
The system has been registered with id: f056fdec-f9cc-4e91-b7ae-940ccc83c26f 
[root@jsefler-onprem-62server ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	Management Add-On        
ProductId:         	management-100           
PoolId:            	8a90f8c631aa31920131aa3309a20267
Quantity:          	1000                     
Multi-Entitlement: 	No                       
Expires:           	08/06/2012               
MachineType:       	physical       


Create an activation key...
[jsefler@jsefler ~]$ curl -k --request POST --user testuser1:password --data '{"name":"ActivationKeyForPool8a90f8c631aa31920131aa3309a20267"}' --header 'accept: application/json' --header 'content-type: application/json'  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
124   311  103   311    0    63   1573    318 --:--:-- --:--:-- --:--:--  3306
{
    "created": "2011-08-08T16:26:57.884+0000", 
    "id": "8a90f8c631aa31920131aa37efdc06fa", 
    "name": "ActivationKeyForPool8a90f8c631aa31920131aa3309a20267", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c631aa31920131aa3205690006", 
        "key": "admin"
    }, 
    "pools": [], 
    "updated": "2011-08-08T16:26:57.884+0000"
}
[jsefler@jsefler ~]$ 


Add the pool to the key with a quantity=5...
[jsefler@jsefler ~]$ curl -k --request POST --user testuser1:password   https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c631aa31920131aa37efdc06fa/pools/8a90f8c631aa31920131aa3309a20267?quantity=5 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2012  100  2012    0     0   7189      0 --:--:-- --:--:-- --:--:-- 12980
{
    "accountNumber": "12331131231", 
    "activeSubscription": true, 
    "attributes": [], 
    "consumed": 0, 
    "contractNumber": "69", 
    "created": "2011-08-08T16:21:36.802+0000", 
    "endDate": "2012-08-07T00:00:00.000+0000", 
    "href": "/pools/8a90f8c631aa31920131aa3309a20267", 
    "id": "8a90f8c631aa31920131aa3309a20267", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c631aa31920131aa3205690006", 
        "key": "admin"
    }, 
    "productAttributes": [
        {
            "created": "2011-08-08T16:21:36.802+0000", 
            "id": "8a90f8c631aa31920131aa3309a2026a", 
            "name": "management_enabled", 
            "productId": "management-100", 
            "updated": "2011-08-08T16:21:36.802+0000", 
            "value": "1"
        }, 
        {
            "created": "2011-08-08T16:21:36.802+0000", 
            "id": "8a90f8c631aa31920131aa3309a20269", 
            "name": "type", 
            "productId": "management-100", 
            "updated": "2011-08-08T16:21:36.802+0000", 
            "value": "MKT"
        }, 
        {
            "created": "2011-08-08T16:21:36.802+0000", 
            "id": "8a90f8c631aa31920131aa3309a20268", 
            "name": "multi-entitlement", 
            "productId": "management-100", 
            "updated": "2011-08-08T16:21:36.802+0000", 
            "value": "no"
        }, 
        {
            "created": "2011-08-08T16:21:36.802+0000", 
            "id": "8a90f8c631aa31920131aa3309a2026c", 
            "name": "arch", 
            "productId": "management-100", 
            "updated": "2011-08-08T16:21:36.802+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2011-08-08T16:21:36.802+0000", 
            "id": "8a90f8c631aa31920131aa3309a2026b", 
            "name": "warning_period", 
            "productId": "management-100", 
            "updated": "2011-08-08T16:21:36.802+0000", 
            "value": "90"
        }, 
        {
            "created": "2011-08-08T16:21:36.803+0000", 
            "id": "8a90f8c631aa31920131aa3309a3026d", 
            "name": "version", 
            "productId": "management-100", 
            "updated": "2011-08-08T16:21:36.803+0000", 
            "value": "1.0"
        }, 
        {
            "created": "2011-08-08T16:21:36.803+0000", 
            "id": "8a90f8c631aa31920131aa3309a3026e", 
            "name": "variant", 
            "productId": "management-100", 
            "updated": "2011-08-08T16:21:36.803+0000", 
            "value": "ALL"
        }
    ], 
    "productId": "management-100", 
    "productName": "Management Add-On", 
    "providedProducts": [], 
    "quantity": 1000, 
    "restrictedToUsername": null, 
    "sourceEntitlement": null, 
    "startDate": "2011-08-08T00:00:00.000+0000", 
    "subscriptionId": "8a90f8c631aa31920131aa330786025d", 
    "updated": "2011-08-08T16:21:36.802+0000"
}



^^^ This should have failed with an displayMessage effectively stating: "Error: Only pools with multi-entitlement product subscriptions can be added to the activation key with a quantity greater than one."

Comment 1 John Sefler 2011-08-22 22:00:24 UTC
Verifying Version...
[root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master
b0ce936b3ad659e6ed5d24216acfa5e050c60851 refs/heads/master
b0ce936b3ad659e6ed5d24216acfa5e050c60851 refs/remotes/origin/master



[root@jsefler-onprem-62server ~]# subscription-manager register --username=testuser1 --password=password --org=admin
The system has been registered with id: 43ac7c92-3456-48d9-9e46-4d1baee84eff 
[root@jsefler-onprem-62server ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	Management Add-On        
ProductId:         	management-100           
PoolId:            	8a90f8c631f1db330131f1dcc9c50279
Quantity:          	1000                     
Multi-Entitlement: 	No                       
Expires:           	08/20/2012               
MachineType:       	physical  

[jsefler@jsefler ~]$ curl -k --request POST --user testuser1:password --data '{"name":"ActivationKeyForPool8a90f8c631f1db330131f1dcc9c50279"}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
124   311  103   311    0    63   1653    334 --:--:-- --:--:-- --:--:--  3875
{
    "created": "2011-08-22T21:52:19.364+0000", 
    "id": "8a90f8c631f1db330131f37ad7a4156c", 
    "name": "ActivationKeyForPool8a90f8c631f1db330131f1dcc9c50279", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c631f1db330131f1dba26c0006", 
        "key": "admin"
    }, 
    "pools": [], 
    "updated": "2011-08-22T21:52:19.364+0000"
}
[jsefler@jsefler ~]$ curl -k --request POST --user testuser1:password https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c631f1db330131f37ad7a4156c/pools/8a90f8c631f1db330131f1dcc9c50279?quantity=5 | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
152   152  152   152    0     0    715      0 --:--:-- --:--:-- --:--:--  1876
{
    "displayMessage": "Error: Only pools with multi-entitlement product subscriptions can be added to the activation key with a quantity greater than one."
}


^^^ VERIFIED That the attempt to add a pool with a non-multi-entitlement product subscription was indeed blocked.

moving to VERIFIED


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