Bug 822665

Summary: Test case failure: SAM: headpin cli product list appears to return products from cp_product, where some products are not currently available to consumers.
Product: [Retired] Subscription Asset Manager Reporter: Eric Sammons <esammons>
Component: katelloAssignee: Tom McKay <tomckay>
Status: CLOSED ERRATA QA Contact: SAM QE List <sam-qe-list>
Severity: high Docs Contact:
Priority: high    
Version: 1.0.0CC: cpelland, dmacpher, jomara, lzap, sachua, tkolhar, tomckay
Target Milestone: rcKeywords: Triaged
Target Release: 1.0   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Manifest imports would not remove unused products or subscriptions. Consequently the headpin CLI listed unavailable products. This update cleans the product listing after a new manifest import. The headpin CLI correctly displays the product list.
Story Points: ---
Clone Of:
: 823890 (view as bug list) Environment:
Last Closed: 2012-06-20 15:20:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 803375, 823890, 827494    
Attachments:
Description Flags
ACME_Corp Content none

Description Eric Sammons 2012-05-17 18:01:19 UTC
Created attachment 585288 [details]
ACME_Corp Content

https://tcms.engineering.redhat.com/case/127976/?from_plan=5985

Version-Release number of selected component (if applicable):
2012-05-16.2

katello-common-0.3.1-1.el6_2.noarch
katello-cli-common-0.3.2-3.el6_2.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
thumbslug-0.0.24-1.el6_2.noarch
katello-glue-candlepin-0.3.1-1.el6_2.noarch
katello-cli-headpin-0.2.0-1.el6_2.noarch
katello-certs-tools-1.1.5-1.el6_2.noarch
katello-configure-0.3.3-2.el6_2.noarch
katello-headpin-0.2.6-4.el6_2.noarch
candlepin-0.6.2-1.el6_2.noarch
candlepin-tomcat6-0.6.2-1.el6_2.noarch
katello-selinux-0.2.4-1.el6_2.noarch
katello-headpin-all-0.2.6-4.el6_2.noarch


Steps to Reproduce: 

 1. On your SAM server login to get a shell.
    Login: username
    Password: password
 2.  Run headpin cli:
    $ headpin -u [admin] -p [password] product list --org [ORG] 



Actual results: 
# headpin -u admin -p admin product list --org ACME_Corporation
--------------------------------------------------------------------------------
    Product List For Organization ACME_Corporation, Environment 'Library'

 Id          Name                                                                     Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
--------------------------------------------------------------------------------
 69          Red Hat Enterprise Linux Server                                          1             Red Hat                                               
 90          Red Hat Enterprise Linux Resilient Storage for RHEL Server               1             Red Hat                                               
 83          Red Hat Enterprise Linux High Availability for RHEL Server               1             Red Hat                                               
 RH1316844   Resilient Storage 8 sockets                                              1             Red Hat                                               
 RH1149049   High-Availability 8 sockets                                              1             Red Hat                                               
 RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   1             Red Hat                                               


DOES NOT Match the webui, see screen shot

Expected results:
Product list is displayed.

Comment 1 Lukas Zapletal 2012-05-18 12:00:07 UTC
@Eric - the test case is not complete, if I login to my SAM installation, I see nothing until I import a manifest. Can you provide me that manifest please?

Comment 2 Eric Sammons 2012-05-18 13:51:20 UTC
@lzap, you are right, let me clarify the reproducer as it is not accurate there.

1. Navigate to Content Management
2. Upload Manifest 1, with entitlements.
3. Upload Manifest 2, _TO_THE_SAME_ORG_ with new entitlements (make them different so you can see clearly)
4. return to cli and execute headpin -u [admin] -p [password] product list --org ACME_Corporation.

I have a new install i'm verifying I can reproduce.

Comment 3 Eric Sammons 2012-05-18 13:53:19 UTC
Test run:

Step 1: With Manifest 1 loaded:

# headpin -u admin -p admin product list --org ACME_Corporation
--------------------------------------------------------------------------------
    Product List For Organization ACME_Corporation, Environment 'Library'

 Id          Name                                                                     Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
--------------------------------------------------------------------------------
 69          Red Hat Enterprise Linux Server                                          1             Red Hat                                               
 RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   1             Red Hat      


Step 2:  With manifest 2 loaded:

# headpin -u admin -p admin product list --org ACME_Corporation
--------------------------------------------------------------------------------
    Product List For Organization ACME_Corporation, Environment 'Library'

 Id          Name                                                                     Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
--------------------------------------------------------------------------------
 RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   1             Red Hat                                               
 83          Red Hat Enterprise Linux High Availability for RHEL Server               1             Red Hat                                               
 RH1149049   High-Availability 8 sockets                                              1             Red Hat                                               
 RH1316844   Resilient Storage 8 sockets                                              1             Red Hat                                               
 69          Red Hat Enterprise Linux Server                                          1             Red Hat                                               
 90          Red Hat Enterprise Linux Resilient Storage for RHEL Server               1             Red Hat

Comment 6 Eric Sammons 2012-05-18 14:34:22 UTC
Looking at the database it appears that cp_pool and cp_pool_products appear to track the known "valid" products.  All product information is retained in cp_products; however, like the webui the cli should only return "valid or usable" products.

Comment 7 Lukas Zapletal 2012-05-21 13:18:02 UTC
Correcting component STS -> SAM.

Comment 8 Eric Sammons 2012-05-22 14:01:33 UTC
Some psql data to support:

1. Install manifest 1 into Org
2. Install manifest 2 into Org


candlepin=> select * from cp_product;
    id     |          created           |          updated           | multiplier |                                    name                                     
-----------+----------------------------+----------------------------+------------+-----------------------------------------------------------------------------
 69        | 2012-05-22 09:58:11.208-04 | 2012-05-22 09:58:11.208-04 |          1 | Red Hat Enterprise Linux Server
 RH0197181 | 2012-05-22 09:58:11.299-04 | 2012-05-22 09:58:11.299-04 |          1 | Red Hat Enterprise Linux Server, Self-support (1-2 sockets) (Up to 1 guest)
 RH1316844 | 2012-05-22 09:58:20.235-04 | 2012-05-22 09:58:20.235-04 |          1 | Resilient Storage (8 sockets)
 RH1149049 | 2012-05-22 09:58:20.254-04 | 2012-05-22 09:58:20.254-04 |          1 | High-Availability (8 sockets)
 83        | 2012-05-22 09:58:20.271-04 | 2012-05-22 09:58:20.271-04 |          1 | Red Hat Enterprise Linux High Availability (for RHEL Server)
 90        | 2012-05-22 09:58:20.29-04  | 2012-05-22 09:58:20.29-04  |          1 | Red Hat Enterprise Linux Resilient Storage (for RHEL Server)


candlepin=> select * from cp_pool_products;
                id                |          created           |          updated           | product_id |                         product_name                         |             pool_id              
----------------------------------+----------------------------+----------------------------+------------+--------------------------------------------------------------+----------------------------------
 8a8b66e83771a4cb013774d75f0c0064 | 2012-05-22 09:58:20.684-04 | 2012-05-22 09:58:20.684-04 | 90         | Red Hat Enterprise Linux Resilient Storage (for RHEL Server) | 8a8b66e83771a4cb013774d75f0b0058
 8a8b66e83771a4cb013774d75f0c0065 | 2012-05-22 09:58:20.684-04 | 2012-05-22 09:58:20.684-04 | 83         | Red Hat Enterprise Linux High Availability (for RHEL Server) | 8a8b66e83771a4cb013774d75f0b0058
 8a8b66e83771a4cb013774d75f2a0073 | 2012-05-22 09:58:20.714-04 | 2012-05-22 09:58:20.714-04 | 83         | Red Hat Enterprise Linux High Availability (for RHEL Server) | 8a8b66e83771a4cb013774d75f290067
(3 rows)

Comment 9 Tom McKay 2012-05-29 15:01:11 UTC
  Branch: refs/heads/master
  Home:   https://github.com/Katello/katello
  Commit: bb587d29aab81e6ff96bc8ecb008f6d25af26f75
      https://github.com/Katello/katello/commit/bb587d29aab81e6ff96bc8ecb008f6d25af26f75
  Author: Ivan Necas <inecas>
  Date:   2012-05-24 (Thu, 24 May 2012)

Products now properly cleaned up after import of new manifest.

Comment 10 Eric Sammons 2012-05-29 18:28:40 UTC
Just a note of additional testing... 2012-05-25.1 does not include latest fix...  A little more detail here, will test the latest when the new puddle is released; however, note.

step 1. install M1 into Org1
step 2. install M2 into Org1
step 3. install M1 into Org1 w/ force
step 4. run product list --org Org1

Results include products from M2 which at this point in time should have been overwritten by M1.

Comment 11 Tom McKay 2012-05-29 18:47:02 UTC
Mistakenly set to MODIFIED instead of ON_DEV

Comment 13 Tazim Kolhar 2012-05-31 11:45:28 UTC
VERIFIED with the build :

[root@ibm-x3950x5-01 ~]# rpm -qa | grep katello
katello-cli-common-0.3.4-1.el6_2.noarch
katello-glue-candlepin-0.3.2-1.el6_2.noarch
katello-configure-0.3.7-1.el6_2.noarch
katello-headpin-all-0.2.10-1.el6_2.noarch
katello-certs-tools-1.1.5-1.el6_2.noarch
katello-selinux-0.2.4-1.el6_2.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-common-0.3.2-1.el6_2.noarch
katello-headpin-0.2.10-1.el6_2.noarch
katello-cli-headpin-0.2.2-1.el6_2.noarch


Imported manifest 1 into Org :

[root@ibm-x3950x5-01 ~]# headpin -u admin -p admin product list --org ACME_Corporation
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                     Product List For Organization ACME_Corporation, Environment 'Library'

 Id          Name                                                                     Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 69          Red Hat Enterprise Linux Server                                          1             Red Hat                                               
 RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   1             Red Hat                                               




Imported manifest 2 into Org:

[root@ibm-x3950x5-01 ~]# headpin -u admin -p admin product list --org ACME_Corporation
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                     Product List For Organization ACME_Corporation, Environment 'Library'

 Id          Name                                                                     Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   1             Red Hat                                               
 RH1149049   High-Availability 8 sockets                                              1             Red Hat                                               
 69          Red Hat Enterprise Linux Server                                          1             Red Hat                                               
 83          Red Hat Enterprise Linux High Availability for RHEL Server               1             Red Hat                                               
 90          Red Hat Enterprise Linux Resilient Storage for RHEL Server               1             Red Hat                                               
 RH1316844   Resilient Storage 8 sockets                                              1             Red Hat                                               


candlepin psql data to support :

candlepin=# select * from cp_product;
    id     |          created           |          updated           | multiplier |                                    name                                     
-----------+----------------------------+----------------------------+------------+-----------------------------------------------------------------------------
 69        | 2012-05-31 01:40:32.255-04 | 2012-05-31 01:40:32.255-04 |          1 | Red Hat Enterprise Linux Server
 RH0197181 | 2012-05-31 01:40:32.455-04 | 2012-05-31 01:40:32.455-04 |          1 | Red Hat Enterprise Linux Server, Self-support (1-2 sockets) (Up to 1 guest)
 RH1316844 | 2012-05-31 01:42:58.91-04  | 2012-05-31 01:42:58.91-04  |          1 | Resilient Storage (8 sockets)
 RH1149049 | 2012-05-31 01:42:58.935-04 | 2012-05-31 01:42:58.935-04 |          1 | High-Availability (8 sockets)
 83        | 2012-05-31 01:42:58.968-04 | 2012-05-31 01:42:58.968-04 |          1 | Red Hat Enterprise Linux High Availability (for RHEL Server)
 90        | 2012-05-31 01:42:58.995-04 | 2012-05-31 01:42:58.995-04 |          1 | Red Hat Enterprise Linux Resilient Storage (for RHEL Server)
(6 rows)

candlepin=# select * from cp_pool_products;
                id                |          created           |          updated           | product_id |                         product_name                         |        
     pool_id              
----------------------------------+----------------------------+----------------------------+------------+--------------------------------------------------------------+--------
--------------------------
 8a90c1cf37a15c420137a16b18440054 | 2012-05-31 01:42:59.396-04 | 2012-05-31 01:42:59.396-04 | 83         | Red Hat Enterprise Linux High Availability (for RHEL Server) | 8a90c1c
f37a15c420137a16b18430048
 8a90c1cf37a15c420137a16b18640061 | 2012-05-31 01:42:59.428-04 | 2012-05-31 01:42:59.428-04 | 83         | Red Hat Enterprise Linux High Availability (for RHEL Server) | 8a90c1c
f37a15c420137a16b18620055
 8a90c1cf37a15c420137a16b18640062 | 2012-05-31 01:42:59.428-04 | 2012-05-31 01:42:59.428-04 | 90         | Red Hat Enterprise Linux Resilient Storage (for RHEL Server) | 8a90c1c
f37a15c420137a16b18620055
(3 rows)

Comment 14 Eric Sammons 2012-06-04 18:01:21 UTC
Per Comment 11 and testing against 2012-06-04.1 puddle I'm setting this to ON_DEV.

Comment 15 Eric Sammons 2012-06-04 18:12:32 UTC
                                   Product List For Organization AAA, Environment 'Library'

 Id          Name                                                                     Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
--------------------------------------------------------------------------------------------------------------------------------
 69          Red Hat Enterprise Linux Server                                          25            Red Hat                                               
 RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   25            Red Hat                                               
 90          Red Hat Enterprise Linux Resilient Storage for RHEL Server               25            Red Hat                                               
 83          Red Hat Enterprise Linux High Availability for RHEL Server               25            Red Hat                                               
 RH1316844   Resilient Storage 8 sockets                                              25            Red Hat                                               
 RH1149049   High-Availability 8 sockets                                              25            Red Hat                                               


After loading M1 and then M2, product list shows products from both M1 and M2 when only products from M2 should appear.

Comment 16 Eric Sammons 2012-06-04 18:20:36 UTC
In my testing I am expecting the results of product list to be equal to that as seen in the webui.  Currently this is not the case, I see additional products that according to the webui I am not entitled to based on the loaded manifest.

====> NOT in M2 === 69          Red Hat Enterprise Linux Server                                          25            Red Hat                                               
====> NOT in M2 === RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   25            Red Hat                                               

===== The following are in M2 ====
 90          Red Hat Enterprise Linux Resilient Storage for RHEL Server               25            Red Hat                                               
 83          Red Hat Enterprise Linux High Availability for RHEL Server               25            Red Hat                                               
 RH1316844   Resilient Storage 8 sockets                                              25            Red Hat                                               
 RH1149049   High-Availability 8 sockets                                              25            Red Hat

Comment 19 Tazim Kolhar 2012-06-08 16:51:53 UTC
VERIFIED with the build:
[root@hp-dl320g6-01 ~]# rpm -qa  | grep katello
katello-selinux-0.2.4-1.el6_2.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-configure-0.3.7-1.el6_2.noarch
katello-common-0.3.3-1.el6_2.noarch
katello-headpin-all-0.2.13-1.el6_2.noarch
katello-cli-headpin-0.2.2-1.el6_2.noarch
katello-glue-candlepin-0.3.3-1.el6_2.noarch
katello-cli-common-0.3.5-2.el6_2.noarch
katello-headpin-0.2.13-1.el6_2.noarch
katello-certs-tools-1.1.5-1.el6_2.noarch


Import manifest1 into Org:
[root@hp-dl320g6-01 ~]# headpin -u admin -p admin product list --org ACME_Corporation
--------------------------------------------------------------------------------
    Product List For Organization ACME_Corporation, Environment 'Library'

 Id          Name                                                                     Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
--------------------------------------------------------------------------------
 69          Red Hat Enterprise Linux Server                                          1             Red Hat                                               
 RH0197181   Red Hat Enterprise Linux Server Self-support 1-2 sockets Up to 1 guest   1             Red Hat     




Import manifest2 into Org:

[root@hp-dl320g6-01 ~]# headpin -u admin -p admin product list --org ACME_Corporation
--------------------------------------------------------------------------------
    Product List For Organization ACME_Corporation, Environment 'Library'

 Id          Name                                                         Provider Id   Provider Name   Sync Plan Name   Last Sync   GPG key  
--------------------------------------------------------------------------------
 83          Red Hat Enterprise Linux High Availability for RHEL Server   1             Red Hat                                               
 RH1149049   High-Availability 8 sockets                                  1             Red Hat                                               
 90          Red Hat Enterprise Linux Resilient Storage for RHEL Server   1             Red Hat                                               
 RH1316844   Resilient Storage 8 sockets                                  1             Red Hat                                               



candlepin=# select * from cp_product;
    id     |          created           |          updated           | multiplie
r |                             name                             
-----------+----------------------------+----------------------------+----------
--+--------------------------------------------------------------
 RH1316844 | 2012-06-08 12:39:27.63-04  | 2012-06-08 12:39:27.63-04  |          
1 | Resilient Storage (8 sockets)
 RH1149049 | 2012-06-08 12:39:27.649-04 | 2012-06-08 12:39:27.649-04 |          
1 | High-Availability (8 sockets)
 83        | 2012-06-08 12:39:27.671-04 | 2012-06-08 12:39:27.671-04 |          
1 | Red Hat Enterprise Linux High Availability (for RHEL Server)
 90        | 2012-06-08 12:39:27.692-04 | 2012-06-08 12:39:27.692-04 |          
1 | Red Hat Enterprise Linux Resilient Storage (for RHEL Server)
(4 rows)

candlepin=# select * from cp_pool_products;
                id                |          created           |          update
d           | product_id |                         product_name                 
        |             pool_id              
----------------------------------+----------------------------+----------------
------------+------------+------------------------------------------------------
--------+----------------------------------
 8a90c2fa37cced6c0137ccf6fe540059 | 2012-06-08 12:39:28.084-04 | 2012-06-08 12:3
9:28.084-04 | 83         | Red Hat Enterprise Linux High Availability (for RHEL 
Server) | 8a90c2fa37cced6c0137ccf6fe53004d
 8a90c2fa37cced6c0137ccf6fe54005a | 2012-06-08 12:39:28.084-04 | 2012-06-08 12:3
9:28.084-04 | 90         | Red Hat Enterprise Linux Resilient Storage (for RHEL 
Server) | 8a90c2fa37cced6c0137ccf6fe53004d
 8a90c2fa37cced6c0137ccf6fe7e0068 | 2012-06-08 12:39:28.126-04 | 2012-06-08 12:3
9:28.126-04 | 83         | Red Hat Enterprise Linux High Availability (for RHEL 
Server) | 8a90c2fa37cced6c0137ccf6fe7d005c
(3 rows)

candlepin=#

Comment 20 sachua 2012-06-13 06:10:31 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The product list in the CLI does not match the product list in the webui. The CLI is listing both marketing and engineering products. The CLI is also listing both active and inactive subscriptions.

Comment 21 sachua 2012-06-14 06:07:10 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-The product list in the CLI does not match the product list in the webui. The CLI is listing both marketing and engineering products. The CLI is also listing both active and inactive subscriptions.+The product list in the CLI does not match the product list in the webui. The CLI is listing both marketing and engineering products. The CLI is also listing both active and inactive subscriptions. With this update, the CLI will only list valid or usable products and match the WEBUI product list.

Comment 22 Dan Macpherson 2012-06-17 07:30:32 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-The product list in the CLI does not match the product list in the webui. The CLI is listing both marketing and engineering products. The CLI is also listing both active and inactive subscriptions. With this update, the CLI will only list valid or usable products and match the WEBUI product list.+Manifest imports would not remove unused products or subscriptions. Consequently the headpin CLI listed unavailable products. This update cleans the product listing after a new manifest import. The headpin CLI correctly displays the product list.

Comment 24 errata-xmlrpc 2012-06-20 15:20:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-1021.html