Revision 97f8a09c
Added by Quirin Pamp 26 days ago
app/services/katello/pulp3/repository.rb | ||
---|---|---|
end
|
||
|
||
def remote_partial_update
|
||
if remote_options[:url]&.start_with?('uln')
|
||
api.remotes_uln_api.partial_update(repo.remote_href, remote_options)
|
||
else
|
||
api.remotes_api.partial_update(repo.remote_href, remote_options)
|
||
url_type = remote_options[:url]&.start_with?('uln') ? 'uln' : 'default'
|
||
remote_type = repo.remote_href.start_with?('/pulp/api/v3/remotes/rpm/uln/') ? 'uln' : 'default'
|
||
href = repo.remote_href
|
||
|
||
if url_type == remote_type
|
||
api.get_remotes_api(href: href).partial_update(href, remote_options)
|
||
else # We need to recreate a remote of the correct type!
|
||
create_remote
|
||
delete_remote(href: href)
|
||
end
|
||
end
|
||
|
||
def delete_remote(options = {})
|
||
options[:href] ||= repo.remote_href
|
||
ignore_404_exception { remote_options[:url]&.start_with?('uln') ? api.remotes_uln_api.delete(options[:href]) : api.remotes_api.delete(options[:href]) } if options[:href]
|
||
ignore_404_exception { api.get_remotes_api(href: options[:href]).delete(options[:href]) } if options[:href]
|
||
end
|
||
|
||
def self.instance_for_type(repo, smart_proxy)
|
||
... | ... | |
end
|
||
|
||
def get_remote(href = repo.remote_href)
|
||
repo.url&.start_with?('uln') ? api.remotes_uln_api.read(href) : api.remotes_api.read(href)
|
||
api.get_remotes_api(href: href).read(href)
|
||
end
|
||
|
||
def get_distribution(href = distribution_reference.href)
|
Also available in: Unified diff
Fixes #37279 - Re-create remotes when the type needs to change
When updating a remote, we need to re-create it instead if the type has
changed from uln to rpm or vice versa.
For operations on a remote href, the type is now determined from the
href, rather than indirectly from the url. This is more robust since it
is the actually relevant source of truth. In addition the remote API
selection code is now deduplicated within the new get_remote_api method.