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 2054123 - hammer repository create ignores --retain-package-versions-count option
Summary: hammer repository create ignores --retain-package-versions-count option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.11.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: 6.11.0
Assignee: Samir Jha
QA Contact: Cole Higgins
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-14 08:50 UTC by Pavel Moravec
Modified: 2022-09-02 18:38 UTC (History)
8 users (show)

Fixed In Version: tfm-rubygem-katello-4.3.0.15-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:33:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34626 0 Normal New hammer repository create ignores --retain-package-versions-count option 2022-03-16 14:26:24 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:33:29 UTC

Description Pavel Moravec 2022-02-14 08:50:52 UTC
Description of problem:
See Creating a repo via hammer with --retain-package-versions-count, the option is effectively ignored.

Further, such a repo cant be updated via WebUI wrt this setting (explanation below).


Version-Release number of selected component (if applicable):
Sat 7.0 snap 9


How reproducible:
100%


Steps to Reproduce:
1. in hammer shell:
product create --organization-id 1 --name test_product
repository create --retain-package-versions-count 1 --name testrepo_1 --product test_product --organization-id 1 --content-type yum
repository create --retain-package-versions-count -3 --name testrepo_-3 --product test_product --organization-id 1 --content-type yum

2. Open the repos in WebUI and check "Retain package versions:" settings.
3. Check the databases for the settings:

su - postgres -c "psql foreman -c \"select id,name,retain_package_versions_count from katello_root_repositories where name ilike '%testrepo%';\""

su - postgres -c "psql pulpcore -c \"select cr.name,rrr.retain_package_versions from rpm_rpmrepository as rrr inner join core_repository as cr on cr.pulp_id = rrr.repository_ptr_id where name ilike '%testrepo%';\""



Actual results:
1. hammer allows creating the repos (even with negative count provided, see relevant https://bugzilla.redhat.com/show_bug.cgi?id=2054121 )

2. WebUI does not show the "Retain package versions:" option for the hammer-created repo (while it does show it properly for a repo created via WebUI)

3. foreman/katello DB does store the retain_package_versions_count provided via hammer, BUT pulpcore stores ZERO value every time.

(I *think* the inconsistency between DBs causes the 2. and also is a good symptom where the bug lies)


Expected results:
2. WebUI to show "Retain package versions:" option for the hammer-created repo as well.
3. Both DBs to store proper values of the setting.


Additional info:

Comment 1 Brad Buckingham 2022-02-14 14:10:35 UTC
Is this a regression from Satellite 6.10?

Comment 2 Pavel Moravec 2022-02-14 14:28:03 UTC
(In reply to Brad Buckingham from comment #1)
> Is this a regression from Satellite 6.10?

Rather incomplete implementation or bug of the "retain package versions count" new 7.0 feature. 6.10 does not have the feature / option at all.

Comment 3 Justin Sherrill 2022-03-10 20:17:27 UTC
I believe all of this may have been resolved by https://bugzilla.redhat.com/show_bug.cgi?id=2054008

Comment 4 Samir Jha 2022-03-16 14:29:58 UTC
> WebUI to show "Retain package versions:" option for the hammer-created repo as well.

There is a discrepancy currently around repos created on UI vs hammer/API. The webUI default for mirroring policy is Additive while the controller default is Content only. The retain package version count is only visible on the UI for repos with additive mirroring policy. Hence the difference in view between UI and hammer created repos.

The correct mirroring policy to default to would be Content only. We'll make that change as part of the BZ. The other issues identified in the BZ should be fixed by https://bugzilla.redhat.com/show_bug.cgi?id=2054008.

Comment 6 Bryan Kearney 2022-03-21 16:05:08 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34626 has been resolved.

Comment 8 Griffin Sullivan 2022-05-02 15:06:15 UTC
Verified in 6.11 snap 18.5 on RHEL 7

Default mirroring policy when creating a repo in hammer is content only. Switching to additive will show retain package counts in the UI and pulp DB.

Steps to Reproduce:
1. hammer product create --organization-id 1 --name test_product
2. hammer repository create --retain-package-versions-count 1 --name testrepo_1 --product test_product --organization-id 1 --content-type yum
3. Optionally check DBs (you'll see a discrepancy as mirror policy is content only)

Expected Results:
Repo is created with mirroring policy set to content only.

Actual Results: 
Repo is created with mirroring policy set to content only.


I can also verify when changing to additive policy you will see the retain package counts in the UI and in the pulp DB. Another note, I'm not sure if this is an issue but when you create the repo above you can see retain package count in katello db. Not sure if we want to have that reflect mirroring policy the same way pulp does. Going to verify for now as it doesn't create any errors.

Comment 11 errata-xmlrpc 2022-07-05 14:33:17 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.11 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-2022:5498


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