This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 784665 - Unable to delete pools referenced by activation keys
Unable to delete pools referenced by activation keys
Status: CLOSED CURRENTRELEASE
Product: Subscription Asset Manager
Classification: Red Hat
Component: katello (Show other bugs)
1.0.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tom McKay
Tazim Kolhar
: Triaged
Depends On:
Blocks: sam11-tracker 810945
  Show dependency treegraph
 
Reported: 2012-01-25 13:12 EST by James Bowes
Modified: 2016-04-25 20:54 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 810945 (view as bug list)
Environment:
Last Closed: 2012-08-21 14:29:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
tomckay: automate_bug? (esammons)


Attachments (Terms of Use)
Deleting the pools referenced by the activation keys. (134.07 KB, image/png)
2012-05-15 05:53 EDT, Tazim Kolhar
no flags Details

  None (edit)
Description James Bowes 2012-01-25 13:12:35 EST
activation keys have a foreign key constrain on pools they reference. there's no logic to delete this link or key when you delete a pool, so trying to delete a pool referenced by an activation key will cause an exception.

This is particularly bad for pools that virt only and derived from a host entitlement. When you attempt to unregister the host, the pool is deleted, but if a key references it, the entire pool deletion and unregistration will result in an exception.

We should probably automatically remove the reference in the activation key to the pool
Comment 2 Chris Duryee 2012-02-23 14:55:58 EST
419e8d3 master 0.5.23+
Comment 3 yu zheng 2012-04-06 05:03:18 EDT
verifying...
1.Register host to SAM and start virt-who. Host consumes a subscription and a bonus pool produces.
2.Register a guest of the host to SAM. Check guest's available pools.
# headpin -u admin -p admin system subscriptions --org=ACME_Corporation --name=localhost.localdomain --available
......
PoolId:            8ac287a3366787b90136866f60923bba
                                          ^^^^^^^^^the bonus pool
PoolName:          Red Hat Enterprise Linux Workstation, Standard
Expires:           2012-07-05
Consumed:          0
Quantity:          1
Sockets:           
MultiEntitlement:  False
Provided products: Red Hat Enterprise Linux Workstation
......

3.Create an actication key and add a bonus pool to the key.
# headpin -u admin -p admin activation_key create --org=ACME_Corporation --name=testkey --environment=env1
Successfully created activation key [ testkey ]
# headpin -u admin -p admin activation_key update --org=ACME_Corporation --name=testkey --add_subscription=8ac287a3366787b90136866f60923bba
Successfully updated activation key [ testkey ]

4.Unsubscribe the host.
# subscription-manager unsubscribe --all

5.Check activation key's info.
# headpin -u admin -p admin activation_key info --org=ACME_Corporation --name=testkey
---------------------------------------------------------
         Activation Key Info
------------------------------------------------------
Id:                 1
Name:               testkey
Description:        None
Environment Id:     2
System Template Id: None
Pools:
    [ 8ac287a3366787b90136866f60923bba ]
                  ^^^^^^^^^^^^^^^^^^^^^^the bonus pool is revoked successfully, but it's not removed from the actication key.
Comment 4 Chris Duryee 2012-04-09 13:23:00 EDT
The behavior in comment #3 appears to be a katello/headpin issue, I am able to replicate it with a sam installation, but not with a bare candlepin.

Moving to katello component.
Comment 5 Tom McKay 2012-04-27 13:54:12 EDT
Testcase Scenarios
==================

1. Register a system and consume a subscription that generates a bonus pool
2. Add this bonus pool to an activation key
3. Unsubscribe the first subscription (thus eliminating the bonus pool)
4. View/query the activation key to confirm bonus pool was removed


1. Import a manifest with a subscription in it
2. Add this sub to an activation key
3. Import a new manifest w/o that pool in it
4. View/query the activation key to confirm bonus pool was removed
Comment 6 Tazim Kolhar 2012-05-15 05:53:29 EDT
Created attachment 584615 [details]
Deleting the pools referenced by the activation keys.

VERIFIED with the build :

[root@hp-dl360g6-01 ~]# rpm -qa | grep katello
katello-cli-headpin-0.2.0-1.el6_2.noarch
katello-glue-candlepin-0.3.1-1.el6_2.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-cli-common-0.3.2-3.el6_2.noarch
katello-selinux-0.2.4-1.el6_2.noarch
katello-headpin-0.2.6-4.el6_2.noarch
katello-certs-tools-1.1.5-1.el6_2.noarch
katello-configure-0.3.3-2.el6_2.noarch
katello-common-0.3.1-1.el6_2.noarch
katello-headpin-all-0.2.6-4.el6_2.noarch

1.) import a manifests and subscribed it to a activation key.
2.) import another manifests without that pool in it .
3.) the pool is removed from the activation key as well.

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