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
419e8d3 master 0.5.23+
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.
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.
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
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.