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 1908141

Summary: Wrong message output when running hammer repository list --content-view-id <id> --organization-id <id>
Product: Red Hat Satellite Reporter: Lai <ltran>
Component: Content ViewsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Danny Synk <dsynk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: chrobert, pcreech, satellite6-bugs, zhunting
Target Milestone: 6.9.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-hammer_cli_katello-0.24.0.2-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-21 13:24:23 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:

Description Lai 2020-12-15 22:33:37 UTC
Description of problem:
hammer repository list --content-view-id <id> --organization-id <id> gives error message "Error: content_view_version not found."

There's also a number of errors happening as well.
1. The correct content-view-id gives the "Error: content_view_version not found."
2. The incorrect content-view-id gives the listed repo.
3. Publishing the cv and running the command yields a duplicate entry.
4. Publishing and republishing a cv yields the message "Error: Found more than one content_view_version" without listing or giving commands for how to pass which version parameter.

Version-Release number of selected component (if applicable):
6.9.0

How reproducible:
100%

Steps to Reproduce:
1. Create a custom product with a custom repo
2. Create a cv
3. Add repo created in step 1 to cv
4. Don't publish cv
5. Run command: hammer repository list --content-view-id <id> --organization-id <id> 

Actual results:
"Error: content_view_version not found."

Expected results:
Output should list the available repos.

Additional info:
Here's the actual result for the other errors:
2.  With incorrect content-view-id
# hammer repository list --content-view-id 2 --organization-id 3
---|-----------------|-------------|--------------|--------------------------------------------------------------------------
ID | NAME            | PRODUCT     | CONTENT TYPE | URL                                                                      
---|-----------------|-------------|--------------|--------------------------------------------------------------------------
6  | FNZSWNPkrNHkUQS | TrhZxjnlFJk | file         | <URL>
---|-----------------|-------------|--------------|--------------------------------------------------------------------------


3. After publishing cv
# hammer repository list --content-view-id 4 --organization-id 3
---|-----------------|-------------|--------------|--------------------------------------------------------------------------
ID | NAME            | PRODUCT     | CONTENT TYPE | URL                                                                      
---|-----------------|-------------|--------------|--------------------------------------------------------------------------
8  | FNZSWNPkrNHkUQS | TrhZxjnlFJk | file         | http://<URL>
7  | FNZSWNPkrNHkUQS | TrhZxjnlFJk | file         | http://<URL>
---|-----------------|-------------|--------------|--------------------------------------------------------------------------

4. After republishing:
# hammer repository list --content-view-id 4 --organization-id 3
Error: Found more than one content_view_version.

Comment 2 Chris Roberts 2021-02-08 21:47:32 UTC
Fixed in https://projects.theforeman.org/issues/31683

Comment 4 Patrick Creech 2021-03-09 16:24:53 UTC
Chris, 

This failed cherrypick.  Can you take a look?

Thanks,
Patrick

Comment 6 Danny Synk 2021-03-19 19:36:12 UTC
Steps to test:

- Deploy a Satellite 6.9, snap 17.
- Create a custom product, add the EPEL repository to the product, and sync EPEL.
- Create a content view and add EPEL to the content view.
- Before publishing the content view, use hammer to list repositories in the content view.

Expected Results:
When using the correct content-view-id and organization-id, hammer should display the repository in the content view without errors.

Actual Results:
When using the correct content-view-id and organization-id, hammer displays the repository in the content view without errors:

# hammer content-view list
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
1               | Default Organization View | Default_Organization_View | false     | 2021/03/11 22:05:17 |               
3               | epel8                     | epel8                     | false     |                     | 21            
2               | rhel8                     | rhel8                     | false     | 2021/03/19 13:41:38 | 2, 1          
----------------|---------------------------|---------------------------|-----------|---------------------|---------------

# hammer repository list --content-view-id 3 --organization-id 1
---|-------|---------|--------------|-----------------------------------------------------------
ID | NAME  | PRODUCT | CONTENT TYPE | URL                                                       
---|-------|---------|--------------|-----------------------------------------------------------
21 | EPEL8 | EPEL8   | yum          | https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/
---|-------|---------|--------------|-----------------------------------------------------------

Verified on Satellite 6.9, snap 17.

Notes:
There is still a duplicate repository listed when the above `hammer repository list` command is run after initially publishing the content view, but the duplicate is not present after publishing the content view a second time. After speaking with Chris about this, I will be filing a new BZ to address this behavior.

Comment 9 errata-xmlrpc 2021-04-21 13:24:23 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 (Moderate: Satellite 6.9 Release), 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/RHSA-2021:1313