Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align on pulp_content_url #9878

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/helpers/katello/katello_urls_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,16 @@ def subscription_manager_configuration_url(host = nil, rpm = true, hostname: nil
end
def repository_url(content_path, _content_type = nil, schema = 'http')
return content_path if content_path =~ %r|^([\w\-\+]+)://|
url = if @host.content_source
"#{schema}://#{@host.content_source.hostname}"
else
foreman_settings_url(schema)
end

url = @host.content_source.pulp_content_url
url.schema = schema
content_path = content_path.sub(%r|^/|, '')
if @host.content_view && [email protected]_view.default?
content_path = [@host.content_view.label, content_path].join('/')
end
path = ::Katello::Glue::Pulp::Repos.repo_path_from_content_path(
@host.lifecycle_environment, content_path)
"#{url}/pulp/content/#{path}"
"#{url}/#{path}"
end
end
end
14 changes: 9 additions & 5 deletions app/models/katello/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,19 @@ def group
end

def full_path(smart_proxy = nil, force_http = false)
pulp_uri = URI.parse(smart_proxy ? smart_proxy.url : ::SmartProxy.pulp_primary.url)
scheme = force_http ? 'http' : 'https'
smart_proxy ||= ::SmartProxy.pulp_primary
pulp_uri = smart_proxy.pulp_content_url
pulp_uri.scheme = force_http ? 'http' : 'https'
# TODO: this should be normalized in smart_proxy_pulp's setting
pulp_uri.host = pulp_uri.host.downcase
if docker?
"#{pulp_uri.host.downcase}/#{container_repository_name}"
"#{pulp_uri.host}/#{container_repository_name}"
elsif ansible_collection?
"#{scheme}://#{pulp_uri.host.downcase}/pulp_ansible/galaxy/#{relative_path}/api/"
"#{scheme}://#{pulp_uri.host}/pulp_ansible/galaxy/#{relative_path}/api/"
else
"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/#{relative_path}/"
pulp_uri.path += "/#{relative_path}"
end
pulp_uri.to_s
end

def to_hash(content_source = nil, force_http = false)
Expand Down
1 change: 1 addition & 0 deletions app/services/katello/pulp/repository/yum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def generate_mirror_importer
end

def partial_repo_path
# TODO: get /pulp/content from pulp_content_url
"/pulp/content/#{repo.relative_path}/".sub('//', '/')
end

Expand Down
1 change: 1 addition & 0 deletions app/services/katello/pulp3/repository/yum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def self.distribution_bootable?(distribution)
end

def partial_repo_path
# TODO: get /pulp/content from pulp_content_url
"/pulp/content/#{repo.relative_path}/".sub('//', '/')
end

Expand Down