This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 732538 - adding a "person" pool to an activation key should be blocked
adding a "person" pool to an activation key should be blocked
Status: CLOSED WONTFIX
Product: Subscription Asset Manager
Classification: Red Hat
Component: candlepin (Show other bugs)
1.3
Unspecified Solaris
unspecified Severity low
: rc
: 1.3
Assigned To: William Poteat
SAM QE List
: Triaged
Depends On:
Blocks: sam13-tracker
  Show dependency treegraph
 
Reported: 2011-08-22 16:21 EDT by John Sefler
Modified: 2013-08-14 16:31 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-14 16:31:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Sefler 2011-08-22 16:21:13 EDT
Description of problem:
As a follow-up to Bug 728721 adding a "person" pool to an activation key should get blocked, otherwise we are giving the illusion that the activation key is useful.

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


How reproducible:


Steps to Reproduce:
Find a pool for a product that requires_consumer_type person...

[root@jsefler-onprem-62server ~]# subscription-manager register
--username=testuser1 --password=password --org=admin --type=person
The system has been registered with id: 837a727a-9113-47bc-a50f-94c55c0ef62d 
[root@jsefler-onprem-62server ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:        Awesome OS Developer Edition
ProductId:          AWESOMEOS09XYU34         
PoolId:             8a90f8c63196bb20013196bc8ff00610
Quantity:           10                       
Expires:            08/02/2012               
MachineType:        physical                 


ProductName:        Awesome OS Developer Edition
ProductId:          AWESOMEOS09XYU34         
PoolId:             8a90f8c63196bb20013196bc90180619
Quantity:           5                        
Expires:            08/02/2012               
MachineType:        physical  


Pick one of these pools.... let's pick 8a90f8c63196bb20013196bc90180619

Now create an activation key...

[jsefler@jseflerT510 ~]$ curl -k --request POST --user testuser1:password
--data '{"name":"ActivationKeyForPool8a90f8c63196bb20013196bc90180619"}'
--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
120   311  100   311    0    63    652    132 --:--:-- --:--:-- --:--:--   847
{
    "created": "2011-08-06T17:29:24.743+0000", 
    "id": "8a90f8c63196bb200131a02464074395", 
    "name": "ActivationKeyForPool8a90f8c63196bb20013196bc90180619", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c63196bb20013196bb9e210006", 
        "key": "admin"
    }, 
    "pools": [], 
    "updated": "2011-08-06T17:29:24.743+0000"
}

Now attempt to bind this activation key to the person pool...

[jsefler@jseflerT510 ~]$ curl -k --request POST --user testuser1:password  
https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/activation_keys/8a90f8c63196bb200131a02464074395/pools/8a90f8c63196bb20013196bc90180619
| python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2055  100  2055    0     0   3791      0 --:--:-- --:--:-- --:--:--  4745
{
    "accountNumber": "12331131231", 
    "activeSubscription": true, 
    "attributes": [], 
    "consumed": 0, 
    "contractNumber": "12", 
    "created": "2011-08-04T21:39:25.336+0000", 
    "endDate": "2012-08-03T00:00:00.000+0000", 
    "href": "/pools/8a90f8c63196bb20013196bc90180619", 
    "id": "8a90f8c63196bb20013196bc90180619", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c63196bb20013196bb9e210006", 
        "key": "admin"
    }, 
    "productAttributes": [
        {
            "created": "2011-08-04T21:39:25.336+0000", 
            "id": "8a90f8c63196bb20013196bc9018061a", 
            "name": "user_license_product", 
            "productId": "AWESOMEOS09XYU34", 
            "updated": "2011-08-04T21:39:25.336+0000", 
            "value": "1144"
        }, 
        {
            "created": "2011-08-04T21:39:25.336+0000", 
            "id": "8a90f8c63196bb20013196bc9018061c", 
            "name": "requires_consumer_type", 
            "productId": "AWESOMEOS09XYU34", 
            "updated": "2011-08-04T21:39:25.336+0000", 
            "value": "person"
        }, 
        {
            "created": "2011-08-04T21:39:25.336+0000", 
            "id": "8a90f8c63196bb20013196bc9018061b", 
            "name": "type", 
            "productId": "AWESOMEOS09XYU34", 
            "updated": "2011-08-04T21:39:25.336+0000", 
            "value": "MKT"
        }, 
        {
            "created": "2011-08-04T21:39:25.336+0000", 
            "id": "8a90f8c63196bb20013196bc9018061d", 
            "name": "arch", 
            "productId": "AWESOMEOS09XYU34", 
            "updated": "2011-08-04T21:39:25.336+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2011-08-04T21:39:25.336+0000", 
            "id": "8a90f8c63196bb20013196bc9018061e", 
            "name": "version", 
            "productId": "AWESOMEOS09XYU34", 
            "updated": "2011-08-04T21:39:25.336+0000", 
            "value": "1.0"
        }, 
        {
            "created": "2011-08-04T21:39:25.337+0000", 
            "id": "8a90f8c63196bb20013196bc90190620", 
            "name": "variant", 
            "productId": "AWESOMEOS09XYU34", 
            "updated": "2011-08-04T21:39:25.337+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2011-08-04T21:39:25.337+0000", 
            "id": "8a90f8c63196bb20013196bc9019061f", 
            "name": "user_license", 
            "productId": "AWESOMEOS09XYU34", 
            "updated": "2011-08-04T21:39:25.337+0000", 
            "value": "unlimited"
        }
    ], 
    "productId": "AWESOMEOS09XYU34", 
    "productName": "Awesome OS Developer Edition", 
    "providedProducts": [], 
    "quantity": 5, 
    "restrictedToUsername": null, 
    "sourceEntitlement": null, 
    "startDate": "2011-08-04T00:00:00.000+0000", 
    "subscriptionId": "8a90f8c63196bb20013196bbf4a600c4", 
    "updated": "2011-08-04T21:39:25.336+0000"
}


^^^ That call to add the pool to the key should have been blocked with a displayMessage stating something to the effect that "Pools requiring a 'person' consumer should not be added to an activation key since a consumer type of 'person' cannot be used with activation keys."  Otherwise you end up with a useless activation key since the attempts to use it will end up with the following... 

[root@jsefler-onprem-62server ~]# subscription-manager register --org=admin --type=person
--activationkey=ActivationKeyForPool8a90f8c63196bb20013196bc90180619
A consumer type of 'person' cannot be used with activation keys
Comment 1 Eric Sammons 2012-02-14 10:26:33 EST
I'm setting this back to NEW as I don't see where a fix or proposed fix was discussed or committed.

In my testing it appears that some work has been done here as type=person is now blocked; however, the error message returned is not very useful.


# subscription-manager register --username=admin --password=admin --org=ACME_Corporation --environment=DEV --type=person
Validation failed: Cp type is not included in the list

katello-headpin-all-0.1.135-2.el6.noarch
Comment 2 Devan Goodwin 2012-08-03 08:25:28 EDT
This is not our most efficient bug of all time. :) This was indeed fixed with the requested message in comment 1 by wpoteat. 

Will: Please note commit hash and branch the fix will appear in.

Eric: In your comment you are reporting the error message client side when using the key, not the error message blocking the person pool from being added to the activation key to begin with. (which is what this bug is about)

I think the message you are reporting is also coming from Katello, so if this is still an issue we should file a separate bug to have that text fix, it looks like rails validation code to me.

I am changing the error message from comment #1 however to something more concise: "Cannot add pools restricted to consumer type 'person' to activation keys."
Comment 3 Jesus M. Rodriguez 2012-08-03 14:11:23 EDT
fixed in master by c387aeb0ef9500de1921b6034cdeedfb599f26be
Will be in candlepin-tomcat6 0.7.5 or later.
Comment 4 Tazim Kolhar 2012-10-15 02:34:14 EDT
FAILED:

Tried testing with the packages :
# rpm -qa |grep katello-headpin-all
katello-headpin-all-1.1.15-2h.el6_3.noarch

# rpm -qa | grep candlepin-tomcat
candlepin-tomcat6-0.7.13-1.el6_3.noarch


On client machine registered to sam server (1.2 puddle) :

# subscription-manager register --username=testuser1 --password=password --org=admin --type person
Validation failed: Cp type is not included in the list


had followed the steps given in the previous comments to verify but it failed in
step 1.

moving it to NEW .
Comment 6 Tom McKay 2012-12-18 09:40:09 EST
Switching product from Subscription Asset Manager to Candlepin for visibility
Comment 7 William Poteat 2012-12-20 09:53:49 EST
Tested in current source on 12/19/12, commit be639376f54aa75ce683bf17a002151eceb3c146


[wpoteat@wpoteat-desktop candlepin (master u=)]$ curl -k -u admin:admin -X POST https://localhost:8443/candlepin/activation_keys/8a8d09953bb8ad52013bb8b1e247003f/pools/8a8d09953bb4a6c9013bb4a7bad504fa
{
  "displayMessage" : "Cannot add pools restricted to consumer type 'person' to activation keys."
}
Comment 8 Bryan Kearney 2013-06-06 16:50:47 EDT
Moving all POST / MODIFIED bugs to ON_QA due to the new builds.
Comment 9 Tazim Kolhar 2013-08-13 13:17:50 EDT
FailedQA :
# rpm -qa | grep katello
katello-selinux-1.4.4-2.el6sat.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
katello-cli-common-1.4.3-5.el6sat.noarch
katello-cli-1.4.3-5.el6sat.noarch
katello-common-1.4.3-6.el6sam_splice.noarch
katello-configure-1.4.4-2.el6sat.noarch
katello-glue-elasticsearch-1.4.3-6.el6sam_splice.noarch
katello-headpin-all-1.4.3-6.el6sam_splice.noarch
katello-glue-candlepin-1.4.3-6.el6sam_splice.noarch
signo-katello-0.0.10-2.el6sat.noarch
katello-headpin-1.4.3-6.el6sam_splice.noarch


# subscription-manager register --username=admin --password=*** --org ACME_Corporation --type person --force
Validation failed: Cp type is not included in the list
Comment 10 Bryan Kearney 2013-08-14 16:31:30 EDT
We dot use person subscriptions. Closing.

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