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 2054008 - Retain packages on Repository does not synchronize the specified number of packages on Satellite 7
Summary: Retain packages on Repository does not synchronize the specified number of pa...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
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-13 22:59 UTC by Manu Sunil
Modified: 2022-07-05 14:33 UTC (History)
3 users (show)

Fixed In Version: tfm-rubygem-katello-4.3.0.9-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 34469 0 Normal New Retain packages on Repository does not synchronize the specified number of packages on Satellite 7 2022-02-17 17:17:47 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:33:29 UTC

Description Manu Sunil 2022-02-13 22:59:13 UTC
Description of problem:

- Retain package versions option on the repository does not retain the specified number of package versions after synchronization.

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

- satellite-7.0.0-0.5.beta.el7sat.noarch
- foreman-3.1.1.4-1.el7sat.noarch

How reproducible:

- Always

Steps to Reproduce:

1. Create a repository to sync a custom product.

2. On the upstream location, add one package and create the repodata.

3. Sync the repository on the Satellite with the following settings.

   Retain Package: 1
   Mirroring Policy: Additive

4. Add another package to the upstream location and recreate the repodata again.

5. Sync the repository on the Satellite with the following settings.

   Retain Package: 2
   Mirroring Policy: Additive


Actual results:

1. First Sync

   The upstream repository:

   ~~~
   # ls 
   kernel-4.18.0-80.el8.x86_64.rpm  repodata
   ~~~

   ~~~
   # hammer repository info --id 27
   Id:                      27
   Name:                    CUSTOM_REPO_3
   Label:                   CUSTOM_REPO_3
   Description:             
   Organization:            RedHat
   Red Hat Repository:      no
   Content Type:            yum
   Mirror on Sync:          no
   Url:                     http://upstreamrepo.example.com/repos/satellite_custom_test_repo/
   Publish Via HTTP:        yes
   Published At:            https://satellite.example.com/pulp/content/RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3/
   Relative Path:           RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3
   Download Policy:         on_demand
   Ignorable Content Units: 
   HTTP Proxy:              
       HTTP Proxy Policy: global_default_http_proxy
   Product:                 
       Id:   294
       Name: CUSTOM_REPOSITORIES
   GPG Key:                 
   
   Sync:                    
       Status:         Success
       Last Sync Date: 1 minute
   Created:                 2022/02/13 06:02:55
   Updated:                 2022/02/13 06:02:58
   Content Counts:          
       Packages:       1
       Source RPMS:    0
       Package Groups: 0
       Errata:         0
       Module Streams: 0
   ~~~


   ~~~
            name         |                        base_path                        |                                        relative_path          

   ----------------------+---------------------------------------------------------+---------------------------------------------------------------
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm                     
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm                     
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm                     
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm                     
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm                     
   ~~~

2. Second Sync after increasing the Retain Package versions to 2.


   ~~~
   hammer> repository info --id 27
   Id:                      27
   Name:                    CUSTOM_REPO_3
   Label:                   CUSTOM_REPO_3
   Description:             
   Organization:            RedHat
   Red Hat Repository:      no
   Content Type:            yum
   Mirror on Sync:          no
   Url:                     http://upstreamrepo.example.com/repos/satellite_custom_test_repo/
   Publish Via HTTP:        yes
   Published At:            https://satellite.example.com/pulp/content/RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3/
   Relative Path:           RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3
   Download Policy:         on_demand
   Ignorable Content Units: 
   HTTP Proxy:              
       HTTP Proxy Policy: global_default_http_proxy
   Product:                 
       Id:   294
       Name: CUSTOM_REPOSITORIES
   GPG Key:                 
   
   Sync:                    
       Status:         Success
       Last Sync Date: 8 minutes
   Created:                 2022/02/13 06:02:55
   Updated:                 2022/02/13 06:09:52
   Content Counts:          
       Packages:       1       <-------- Package count is still one.     
       Source RPMS:    0
       Package Groups: 0
       Errata:         0
       Module Streams: 0
   ~~~

   The package changed to the newest version from the upstream repository and the old version was removed. 


           name         |                        base_path                        |                                        relative_path                                     
   ----------------------+---------------------------------------------------------+------------------------------------------------------
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm        
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm        
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm        
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm        
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm        


3. Added another package to the upstream repository and synced again with Retain Package Versions package value 5

   Upstream Repository.

   ~~~
   # ll 
   total 1228 
   -rw-r--r--. 1 root root 415364 May 14  2019 kernel-4.18.0-80.1.2.el8_0.x86_64.rpm 
   -rw-r--r--. 1 root root 419436 Jun 17  2019 kernel-4.18.0-80.4.2.el8_0.x86_64.rpm 
   -rw-r--r--. 1 root root 409836 Mar 21  2019 kernel-4.18.0-80.el8.x86_64.rpm
   drwxr-xr-x. 2 root root   4096 Feb 13 12:03 repodata
   ~~~

   # zgrep metadata repodata/*primary*
   repodata/caa37f79857badc4a11db3de3451b146364ebb76390c6b9e879ad6e6943800a9-primary.xml.gz:<metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="3">


   ~~~
   hammer> repository info --id 27
   Id:                      27
   Name:                    CUSTOM_REPO_3
   Label:                   CUSTOM_REPO_3
   Description:             
   Organization:            RedHat
   Red Hat Repository:      no
   Content Type:            yum
   Mirror on Sync:          no
   Url:                     http://upstreamrepo.example.com/repos/satellite_custom_test_repo/
   Publish Via HTTP:        yes
   Published At:            https://satellite.example.com/pulp/content/RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3/
   Relative Path:           RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3
   Download Policy:         on_demand
   Ignorable Content Units: 
   HTTP Proxy:              
       HTTP Proxy Policy: global_default_http_proxy
   Product:                 
       Id:   294
       Name: CUSTOM_REPOSITORIES
   GPG Key:                 
   
   Sync:                    
       Status:         Success
       Last Sync Date: 3 minutes
   Created:                 2022/02/13 06:02:55
   Updated:                 2022/02/13 06:37:24
   Content Counts:          
       Packages:       1
       Source RPMS:    0
       Package Groups: 0
       Errata:         0
       Module Streams: 0
   ~~~

  
   Similarly like before the package changed to the newer version but the older versions were removed even though the Retain Package Versions option is set to 5


            name         |                        base_path                        |                                        relative_path    
   ----------------------+---------------------------------------------------------+---------------------------------------------------------
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm         
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm         
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm         
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm         
    CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm         

- Each time the repository is synced after adding new packages, the old packages are removed and the specified count of versions is not retained.

Expected results:

- The specified count of package versions should be synced.

Comment 2 Samir Jha 2022-02-17 17:17:46 UTC
Created redmine issue https://projects.theforeman.org/issues/34469 from this bug

Comment 5 Bryan Kearney 2022-02-23 20:05:38 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34469 has been resolved.

Comment 8 Silas Pusateri 2022-05-03 17:49:49 UTC
Verified.

Version tested: Sat 6.11 snap 18.5

Steps:
1. Create a repo with a negative 'retain_package_versions_count'
2. Try to save the repo
3. After it fails, set the 'retain_package_versions_count' to a positive number
4. Save the repo 
5. Ensure the correct 'retain_package_versions_count' is set 
6. Sync the repo

Expected result:
The repo should sync the correct number of packages based on 'retain_package_versions_count'

Result:
The repo syncs the correct number of packages based on 'retain_package_versions_count'

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.