Revision 97f8a09c
Added by Quirin Pamp 26 days ago
app/services/katello/pulp3/alternate_content_source.rb | ||
---|---|---|
end
|
||
|
||
def get_remote(href = smart_proxy_acs.remote_href)
|
||
acs.base_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 update_remote
|
||
api.remotes_api.partial_update(smart_proxy_acs.remote_href, remote_options)
|
||
def update_remote(href = smart_proxy_acs.remote_href)
|
||
api.get_remotes_api(href: href).partial_update(href, remote_options)
|
||
end
|
||
|
||
# The old repo URL is needed to determine which remote API to use.
|
||
def delete_remote(options = {})
|
||
options[:href] ||= smart_proxy_acs.remote_href
|
||
options[:old_url] ||= remote_options[:url]
|
||
ignore_404_exception { options[:old_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 create
|
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.