Project

General

Profile

Actions

Bug #36787

closed

Delete orphan content task doesn't remove orphaned remotes in the smart proxy

Added by Samir Jha 9 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Foreman Proxy Content
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2239767

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.

Actions #1

Updated by The Foreman Bot 9 months ago

  • Status changed from New to Ready For Testing
  • Assignee set to Samir Jha
  • Pull request https://github.com/Katello/katello/pull/10755 added
Actions #2

Updated by Quinn James 9 months ago

  • Subject changed from Delete oprhan content task doesn't remove orphaned remotes in the Capsule to Delete oprhan content task doesn't remove orphaned remotes in the Capsule
  • Target version set to Katello 4.11.0
  • Triaged changed from No to Yes
Actions #3

Updated by The Foreman Bot 9 months ago

  • Fixed in Releases Katello 4.11.0 added
Actions #4

Updated by Samir Jha 9 months ago

  • Status changed from Ready For Testing to Closed
Actions #5

Updated by Ian Ballou 7 months ago

  • Subject changed from Delete oprhan content task doesn't remove orphaned remotes in the Capsule to Delete orphan content task doesn't remove orphaned remotes in the smart proxy
Actions

Also available in: Atom PDF