Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1250610

Summary: hammer activation key product-content does not filter content based on organization
Product: Red Hat Satellite Reporter: sthirugn <sthirugn>
Component: HammerAssignee: Zach Huntington-Meath <zhunting>
Status: CLOSED ERRATA QA Contact: sthirugn <sthirugn>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bkearney, cwelton, ehelms, sthirugn, tomckay
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14043
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:00:05 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: 1324884    
Bug Blocks: 1317679    

Description sthirugn@redhat.com 2015-08-05 14:41:24 UTC
Description of problem:
hammer activation key product-content does not filter content based on organization

Version-Release number of selected component (if applicable):
Sat 6.1 GA Snap 15

How reproducible:
Always

Steps to Reproduce:
1. Create two Orgs - enable, sync different RH content on both the orgs
2. Create an activation key, attach subscription and navigate to web ui -> select the activation key -> Product Content tab -> See that the enabled/synced repos are displayed there - this works as expected
3. Check the same in hammer cli:


hammer> activation-key product-content --id=1 
-----|-----------------------------------------------------------|------|-----|---------|------------------------------------------
ID   | NAME                                                      | TYPE | URL | GPG KEY | LABEL                                    
-----|-----------------------------------------------------------|------|-----|---------|------------------------------------------
2456 | Red Hat Enterprise Linux 7 Server (RPMs)                  |      |     |         | rhel-7-server-rpms                       
4362 | Red Hat Satellite Tools 6 Beta (for RHEL 6 Server) (RPMs) |      |     |         | rhel-6-server-satellite-tools-6-beta-rpms
168  | Red Hat Enterprise Linux 6 Server (RPMs)                  |      |     |         | rhel-6-server-rpms                       
3455 | MRG Grid (for RHEL 6 Server) (RPMs)                       |      |     |         | rhel-6-server-mrg-grid-rpms              
4362 | Red Hat Satellite Tools 6 Beta (for RHEL 6 Server) (RPMs) |      |     |         | rhel-6-server-satellite-tools-6-beta-rpms
168  | Red Hat Enterprise Linux 6 Server (RPMs)                  |      |     |         | rhel-6-server-rpms                       
3455 | MRG Grid (for RHEL 6 Server) (RPMs)                       |      |     |         | rhel-6-server-mrg-grid-rpms              
4362 | Red Hat Satellite Tools 6 Beta (for RHEL 6 Server) (RPMs) |      |     |         | rhel-6-server-satellite-tools-6-beta-rpms
-----|-----------------------------------------------------------|------|-----|---------|------------------------------------------


hammer> activation-key product-content --id=1 --organization-id=3
-----|-----------------------------------------------------------|------|-----|---------|------------------------------------------
ID   | NAME                                                      | TYPE | URL | GPG KEY | LABEL                                    
-----|-----------------------------------------------------------|------|-----|---------|------------------------------------------
2456 | Red Hat Enterprise Linux 7 Server (RPMs)                  |      |     |         | rhel-7-server-rpms                       
4362 | Red Hat Satellite Tools 6 Beta (for RHEL 6 Server) (RPMs) |      |     |         | rhel-6-server-satellite-tools-6-beta-rpms
168  | Red Hat Enterprise Linux 6 Server (RPMs)                  |      |     |         | rhel-6-server-rpms                       
3455 | MRG Grid (for RHEL 6 Server) (RPMs)                       |      |     |         | rhel-6-server-mrg-grid-rpms              
4362 | Red Hat Satellite Tools 6 Beta (for RHEL 6 Server) (RPMs) |      |     |         | rhel-6-server-satellite-tools-6-beta-rpms
168  | Red Hat Enterprise Linux 6 Server (RPMs)                  |      |     |         | rhel-6-server-rpms                       
3455 | MRG Grid (for RHEL 6 Server) (RPMs)                       |      |     |         | rhel-6-server-mrg-grid-rpms              
4362 | Red Hat Satellite Tools 6 Beta (for RHEL 6 Server) (RPMs) |      |     |         | rhel-6-server-satellite-tools-6-beta-rpms
-----|-----------------------------------------------------------|------|-----|---------|------------------------------------------

Actual results:
Both the hammer commands listed above lists all the enabled/synced repos across all the organizations of this satellite

Expected results:
Both the above commands should list the enabled/sync repos corresponding to the current organization (selected activation key's organization) only.

Additional info:

Comment 2 Zach Huntington-Meath 2016-03-03 14:59:30 UTC
Created redmine issue http://projects.theforeman.org/issues/14043 from this bug

Comment 3 Zach Huntington-Meath 2016-03-03 16:45:14 UTC
I have tested this with two organizations, and found that if searched with an activation key it only brings back the product content for that activation key and organization. Since an activation key implicitly belongs to one organization it seems to follow that giving it an organization to filter it with as well seems unnecessary. Please let me know what you think, thanks!

Comment 4 Zach Huntington-Meath 2016-03-07 15:32:17 UTC
Originally I had tested this issue with non-redhat products. I discovered that after enabling Red Hat Repositories and subscribing them to an activation-key they can provide the same content. This gives the appearance of duplicates showing up in calls for an activation-keys product content. I will fix this issue, and then it should be working as intended.

Comment 5 Zach Huntington-Meath 2016-03-15 15:01:55 UTC
The issue with duplicate content showing up will no longer occur. As stated before there is no need to filter by organization-id as an Activation-key is unique to an organization. I looked into removing it as an option in hammer but it is used by activation-key product-content --name as a way of knowing which activation-key id to use when making a call to the API. I discussed this with some team mates and we decided that because it is a quirk with Hammer and not Katello the API should not be changed either.

Comment 6 Bryan Kearney 2016-03-15 16:06:28 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14043 has been closed

Comment 7 sthirugn@redhat.com 2016-03-24 20:08:15 UTC
Failed in Satellite-6.2-beta-snap-5.1.

The activation keys below are from different org and enabled with different manifests, RH repositories.  Notice that they are listing the same RH repos.  Custom products are filtered correctly per the activation key/org.

hammer> activation-key product-content --id=1
--------------|-----------------------------------------------|------|-----|---------|-----------------------------------------------|---------
ID            | NAME                                          | TYPE | URL | GPG KEY | LABEL                                         | ENABLED?
--------------|-----------------------------------------------|------|-----|---------|-----------------------------------------------|---------
2455          | Red Hat Enterprise Linux 7 Server (Kickstart) |      |     |         | rhel-7-server-kickstart                       | 1       
2456          | Red Hat Enterprise Linux 7 Server (RPMs)      |      |     |         | rhel-7-server-rpms                            | default 
1458779349329 | rhel7sat6tools                                |      |     |         | Default_Organization_sat6tools_rhel7sat6tools | default 
--------------|-----------------------------------------------|------|-----|---------|-----------------------------------------------|---------
hammer> activation-key list --or
--order                --organization         --organization-id      --organization-label   
hammer> activation-key list --organization-id=3
---|-------------|----------------|-----------------------|-----------------
ID | NAME        | HOST LIMIT     | LIFECYCLE ENVIRONMENT | CONTENT VIEW    
---|-------------|----------------|-----------------------|-----------------
2  | sthirugn_ak | 0 of Unlimited | Library               | test_sthirugn_cv
---|-------------|----------------|-----------------------|-----------------
hammer> 
hammer> activation-key product-content --id=2
--------------|-----------------------------------------------|------|-----|---------|---------------------------------|---------
ID            | NAME                                          | TYPE | URL | GPG KEY | LABEL                           | ENABLED?
--------------|-----------------------------------------------|------|-----|---------|---------------------------------|---------
2455          | Red Hat Enterprise Linux 7 Server (Kickstart) |      |     |         | rhel-7-server-kickstart         | default 
2456          | Red Hat Enterprise Linux 7 Server (RPMs)      |      |     |         | rhel-7-server-rpms              | default 
1458848295245 | testrepo1                                     |      |     |         | sthirugn_testproduct1_testrepo1 | default 
--------------|-----------------------------------------------|------|-----|---------|---------------------------------|---------

Comment 8 Zach Huntington-Meath 2016-03-29 16:22:15 UTC
I think that I have fixed the problem causing this error and the PR has been merged.

Comment 9 Corey Welton 2016-03-29 20:31:30 UTC
Marking as a blocker+ as this commit fixes bug #1317679, which is a blocker itself.

This will assure that both, perhaps subtly different behaviors, are verified.

QE NOTES:

Test both this bug and bug #1317679 at the same time.

Comment 11 Tom McKay 2016-03-29 23:18:28 UTC
Still broken.

Comment 12 Tom McKay 2016-03-30 01:17:29 UTC
Confirmed fixed

Comment 13 sthirugn@redhat.com 2016-04-07 13:45:06 UTC
Failed in satellite-6.2.0-6.2.beta.el7sat.noarch due to the following error:

hammer> activation-key product-content --id=1
undefined method `map' for nil:NilClass

A separate bug is written as well - https://bugzilla.redhat.com/show_bug.cgi?id=1324884

Comment 14 Zach Huntington-Meath 2016-04-08 12:24:39 UTC
This new part of the bug was fixed last night. https://github.com/Katello/katello/pull/5945

Comment 15 sthirugn@redhat.com 2016-04-12 16:04:54 UTC
Verified in satellite-6.2.0-7.0.beta.el7sat.noarch


hammer> activation-key product-content --id=1
--------------|-----------------------------------------------|------|-----|----
ID            | NAME                                          | TYPE | URL | GPG KEY | LABEL                                        | ENABLED?
--------------|-----------------------------------------------|------|-----|----
1460390504117 | sat6toolsrepo                                 |      |     |         | Default_Organization_sat6tools_sat6toolsrepo | default 
2455          | Red Hat Enterprise Linux 7 Server (Kickstart) |      |     |         | rhel-7-server-kickstart                      | 1       
2456          | Red Hat Enterprise Linux 7 Server (RPMs)      |      |     |         | rhel-7-server-rpms                           | default 



hammer> activation-key product-content --id=2
--------------|-----------------------------------------------------------------
ID            | NAME                                                                     | TYPE | URL | GPG KEY | LABEL                                                          | ENABLED?
--------------|-----------------------------------------------------------------
3815          | Red Hat Virt V2V Tool for RHEL 7 (RPMs)                                  |      |     |         | rhel-7-server-v2vwin-1-rpms                                    | default 
2386          | Red Hat Virt V2V Tool for RHEL 6 (RPMs)                                  |      |     |         | rhel-6-server-v2vwin-1-rpms                                    | default 
4539          | Red Hat OpenStack Tools 7.0 for Red Hat Enterprise Linux 7 Server (RPMs) |      |     |         | rhel-7-server-openstack-7.0-tools-rpms                         | default 
1430          | Red Hat Subscription Asset Manager (for RHEL 6 Server) (RPMs)            |      |     |         | rhel-6-server-sam-rpms                                         | default 
1460476153103 | testorg_customproduct_customrepo                                         |      |     |         | testorg_testorg_customproduct_testorg_customproduct_customrepo | default

Comment 17 Bryan Kearney 2016-07-27 11:00:05 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.

https://access.redhat.com/errata/RHBA-2016:1501