Skip to content

Commit

Permalink
Fixes #36787 - Delete oprhan content task doesn't remove orphaned rem…
Browse files Browse the repository at this point in the history
…otes in the Capsule (#10755)
  • Loading branch information
sjha4 authored Oct 5, 2023
1 parent 7fb4c8e commit be25c08
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/services/katello/pulp3/api/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def remotes_list(args = {})
remotes_api.list(args).results
end

def remotes_list_all(_smart_proxy, options)
def remotes_list_all(_smart_proxy, options = {})
self.class.fetch_from_list do |page_opts|
remotes_api.list(page_opts.merge(options))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def delete_orphan_remotes
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
remotes = api.remotes_list_all(smart_proxy)

remotes.each do |remote|
if !repo_names.include?(remote.name) && !acs_remotes.include?(remote.pulp_href)
Expand Down
2 changes: 1 addition & 1 deletion test/services/katello/pulp3/smart_proxy_repository_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_delete_orphan_remotes

smart_proxy_mirror_repo.expects(:pulp3_enabled_repo_types).once.returns([::Katello::RepositoryTypeManager.find(:yum)])
::Katello::SmartProxyHelper.any_instance.expects(:combined_repos_available_to_capsule).once.returns([fedora, rhel6])
::Katello::Pulp3::Api::Yum.any_instance.expects(:remotes_list).once.returns(pulp_remotes)
::Katello::Pulp3::Api::Yum.any_instance.expects(:remotes_list_all).once.returns(pulp_remotes)
::Katello::Pulp3::Api::Yum.any_instance.expects(:delete_remote).once.with(rhel7_href).returns('rhel-7-gone')

assert_equal ['rhel-7-gone'], smart_proxy_mirror_repo.delete_orphan_remotes
Expand Down

0 comments on commit be25c08

Please sign in to comment.