Bug #34626
closedhammer repository create ignores --retain-package-versions-count option
Description
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: