Bug 646624 - Register, if creating an owner, should pull in all subscriptions for that owner
Summary: Register, if creating an owner, should pull in all subscriptions for that owner
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: ---
Assignee: Jesus M. Rodriguez
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: 738066
TreeView+ depends on / blocked
 
Reported: 2010-10-25 19:02 UTC by Bryan Kearney
Modified: 2015-05-14 16:04 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-01 18:34:38 UTC
Embargoed:


Attachments (Terms of Use)

Description Bryan Kearney 2010-10-25 19:02:09 UTC
Candlepin can create an owner at registration time if it is returned from the user service and does not exist in the CP database. If that occurs, we should also pull in all the susbcriptions and refresh the pools for the new owner.

Comment 1 Jesus M. Rodriguez 2011-01-14 15:14:54 UTC
added a call to refresh pools

Comment 2 John Sefler 2011-01-24 15:33:19 UTC
Please suggest a test scenario to verify this bugzilla.

Comment 3 Bryan Kearney 2011-01-24 15:41:21 UTC
add a new user to the user db, which maps to owner XYZ. Add new subscriptions for owner XYZ. Then, register with that new user. You should see the subscriptions right away.

Comment 4 John Sefler 2011-03-18 21:18:33 UTC
My attempt to verify....
1. Create a new user (testuser5) which maps to owner (admin)...

[root@jsefler-onprem-server ~]#  curl -d '{"username":"testuser5","password":"password"}' -u admin:admin -k --request POST https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/owners/admin/users --header "Content-type: application/json" | json_reformat 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
233   187    0   187    0    46   1035    254 --:--:-- --:--:-- --:--:--  5035
{
  "id": "8a90f8b42eca6e8a012ecac893fa023d",
  "username": "testuser5",
  "password": "password",
  "superAdmin": false,
  "updated": "2011-03-18T21:04:26.106+0000",
  "created": "2011-03-18T21:04:26.106+0000"
}



2. Add a new subscription for owner (admin) (note the quantity=555).

[root@jsefler-onprem-server ~]#  curl -k --request POST --user admin:admin --data '{"product":{"id":"awesomeos-server-basic"},"startDate":"Thu, 17 Mar 2011 12:30:06 -0400","quantity":555,"endDate":"2012-03-19T00:00:00.000+0000","contractNumber":689793899,"providedProducts":[]}' --header 'content-type: application/json'  https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/owners/admin/subscriptions | json_reformat 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
115  1775    0  1775    0   194  12978   1418 --:--:-- --:--:-- --:--:-- 41605
{
  "id": "8a90f8b42eca6e8a012ecac96f83023e",
  "owner": {
    "href": "/owners/admin",
    "id": "8a90f8b42eca6e8a012eca6eb78f0005"
  },
  "certificate": null,
  "product": {
    "name": "Awesome OS Server Basic",
    "id": "awesomeos-server-basic",
    "attributes": [
      {
        "name": "version",
        "value": "1.0",
        "updated": "2011-03-18T19:26:31.396+0000",
        "created": "2011-03-18T19:26:31.396+0000"
      },
      {
        "name": "variant",
        "value": "ALL",
        "updated": "2011-03-18T19:26:31.397+0000",
        "created": "2011-03-18T19:26:31.397+0000"
      },
      {
        "name": "support_type",
        "value": "Self-Support",
        "updated": "2011-03-18T19:26:31.397+0000",
        "created": "2011-03-18T19:26:31.397+0000"
      },
      {
        "name": "sockets",
        "value": "2",
        "updated": "2011-03-18T19:26:31.397+0000",
        "created": "2011-03-18T19:26:31.397+0000"
      },
      {
        "name": "arch",
        "value": "ALL",
        "updated": "2011-03-18T19:26:31.397+0000",
        "created": "2011-03-18T19:26:31.397+0000"
      },
      {
        "name": "management_enabled",
        "value": "0",
        "updated": "2011-03-18T19:26:31.397+0000",
        "created": "2011-03-18T19:26:31.397+0000"
      },
      {
        "name": "type",
        "value": "MKT",
        "updated": "2011-03-18T19:26:31.397+0000",
        "created": "2011-03-18T19:26:31.397+0000"
      },
      {
        "name": "support_level",
        "value": "None",
        "updated": "2011-03-18T19:26:31.397+0000",
        "created": "2011-03-18T19:26:31.397+0000"
      },
      {
        "name": "warning_period",
        "value": "30",
        "updated": "2011-03-18T19:26:31.398+0000",
        "created": "2011-03-18T19:26:31.398+0000"
      }
    ],
    "multiplier": 1,
    "productContent": [

    ],
    "dependentProductIds": [

    ],
    "href": "/products/awesomeos-server-basic",
    "updated": "2011-03-18T19:26:31.396+0000",
    "created": "2011-03-18T19:26:31.396+0000"
  },
  "providedProducts": [

  ],
  "endDate": "2012-03-19T00:00:00.000+0000",
  "startDate": "2011-03-17T16:30:06.000+0000",
  "quantity": 555,
  "contractNumber": "689793899",
  "accountNumber": null,
  "modified": null,
  "tokens": null,
  "upstreamPoolId": null,
  "updated": "2011-03-18T21:05:22.307+0000",
  "created": "2011-03-18T21:05:22.307+0000"
}



3. register with the new user (testuser5)...


[root@jsefler-onprem-server ~]# subscription-manager register --username=testuser5 --password=password
3f5b7ebf-27bc-4c4c-9571-ed639192dd42 jsefler-onprem-server.usersys.redhat.com



4. list the subscriptions and look for the new one (with quantity=555)

[root@jsefler-onprem-server ~]# subscription-manager list --available | grep Quantity
Quantity:          	1000                     
Quantity:          	500                      
Quantity:          	10                       
Quantity:          	40                       
Quantity:          	5                        
Quantity:          	20                       
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5                        
Quantity:          	10                       
Quantity:          	5     


^^^ I do NOT see the new pool with quantity=555  Fails_QA                 


Note...  if I manually refresh pools, then the new user will see the new pool.

[root@jsefler-onprem-server ~]#  curl -k --request PUT --user admin:admin --header 'content-type: application/json'  https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/owners/admin/subscriptions | json_reformat 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
140   280    0   280    0     0   1347      0 --:--:-- --:--:-- --:--:--  5283
{
  "id": "refresh_pools_48ac125c-e2ee-4b34-b49c-c428f2a03a94",
  "state": "CREATED",
  "result": null,
  "startTime": null,
  "finishTime": null,
  "statusPath": "/jobs/refresh_pools_48ac125c-e2ee-4b34-b49c-c428f2a03a94",
  "updated": "2011-03-18T21:12:35.749+0000",
  "created": "2011-03-18T21:12:35.749+0000"
}
[root@jsefler-onprem-server ~]# subscription-manager list --available | grep 555
Quantity:          	555                      
[root@jsefler-onprem-server ~]# 



Putting back on ASSIGNED since the new subscription pool does not appear immediately upon registration as indicated in Comment #3

Comment 6 Bryan Kearney 2012-03-01 18:34:38 UTC
Closing as I do not believe this is needed. Please re-open if I am incorrect.


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