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 2239767 - Delete oprhan content task doesn't remove orphaned remotes in the Capsule
Summary: Delete oprhan content task doesn't remove orphaned remotes in the Capsule
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Capsule - Content
Version: 6.13.5
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.15.0
Assignee: Samir Jha
QA Contact: Sam Bible
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-09-20 05:31 UTC by Hao Chang Yu
Modified: 2024-10-18 07:52 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-04-23 17:14:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36787 0 Normal New Delete oprhan content task doesn't remove orphaned remotes in the Capsule 2023-09-27 16:24:36 UTC
Red Hat Issue Tracker SAT-20211 0 None None None 2023-09-20 05:33:40 UTC
Red Hat Knowledge Base (Solution) 7034525 0 None None None 2023-10-04 11:25:00 UTC
Red Hat Product Errata RHSA-2024:2010 0 None None None 2024-04-23 17:14:40 UTC

Description Hao Chang Yu 2023-09-20 05:31:57 UTC
Description of problem:
If a Capsule has more than 100 Pulp 3 remotes, the delete orphan content task will fail to scan for any orphan Pulp 3 remotes in the Capsule.

This is because Pulp API by default only returns 100 records. If a Capsule has more than 100 Pulp 3 remotes, then part of the remotes will not be returned by the API call.


app/services/katello/pulp3/smart_proxy_mirror_repository.rb
~~~
      def delete_orphan_remotes
        tasks = []
        smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
        repo_names = smart_proxy_helper.combined_repos_available_to_capsule.map(&:pulp_id)
        acs_remotes = Katello::SmartProxyAlternateContentSource.pluck(:remote_href)
        pulp3_enabled_repo_types.each do |repo_type|
          api = repo_type.pulp3_api(smart_proxy)
          remotes = api.remotes_list   <==================== This call will only return 100 remotes

          remotes.each do |remote|
            if !repo_names.include?(remote.name) && !acs_remotes.include?(remote.pulp_href)
              tasks << api.delete_remote(remote.pulp_href)
            end
          end
        end
        tasks
      end
~~~

If you replace the line with the following line then the issue is fixed.
~~~
remotes = api.remotes_list(limit: 10000)
~~~


How reproducible:
easy


Steps to Reproduce:
1. On Satellite, enable and sync some repositories.
2. Create some content views and some LCEs and then attach the repositories to the CVs.
3. Add the LCEs to the Capsule.
4. Make sure the total number of content views' repositories * number of LCEs > 200. It is because the higher the easier to reproduce the issue.
5. Publish and promote the content views which should trigger auto Capsule sync.
6. Remove some repositories from the content views, and then publish and promote new versions.
7. Trigger delete orphan content task
~~~
foreman-rake katello:delete_orphaned_content
~~~

Actual results:
Either no orphan remotes are deleted or some orphan remotes are not deleted.


Expected results:
Delete all orphan remotes in the Capsule.


Additional infos:
Leaving the orphan remotes undeleted might cause the Pulp content app to pick the wrong/outdated remote to download contents. It will then fail to download content using the wrong/outdated remote.

Comment 1 Samir Jha 2023-09-27 16:24:34 UTC
Created redmine issue https://projects.theforeman.org/issues/36787 from this bug

Comment 2 Bryan Kearney 2023-10-05 20:02:42 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36787 has been resolved.

Comment 4 Sam Bible 2024-02-07 01:04:08 UTC
Steps to Reproduce:
1. On Satellite, enable and sync 120 repositories.
2. Add these to a CV, and promote to 2 different LCEs.
3. Add the LCEs to the Capsule.
5. Publish and promote the content views which should trigger auto Capsule sync.
6. Remove some repositories from the content views, and then publish and promote new versions.
7. Trigger delete orphan content task
~~~
foreman-rake katello:delete_orphaned_content
~~~

Actual results:
The orphaned content task is triggered and completed.


Expected results:
The orphaned content task is triggered and completed. Orphaned content on capsule is removed.

Comment 7 errata-xmlrpc 2024-04-23 17:14:38 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 (Important: Satellite 6.15.0 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-2024:2010


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