Sha256: 8d40238a07b097a6e66d2ca0cbffde65105081a8eb03413290bf99d82a98d9c8

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

Stored size: 1.3 KB

Contents

require 'uri'

module Katello
  module KatelloUrlsHelper
    def foreman_settings_url(schema = 'http')
      ::Setting[:foreman_url].sub(%r|^.*?:|, "#{schema}:")
    end

    def subscription_manager_configuration_url(host = nil, rpm = true, hostname: nil)
      prefix = if hostname
                 "http://#{hostname}"
               elsif host&.content_source
                 "http://#{host.content_source.hostname}"
               else
                 foreman_settings_url
               end

      config = rpm ? SETTINGS[:katello][:consumer_cert_rpm] : SETTINGS[:katello][:consumer_cert_sh]

      "#{prefix}/pub/#{config}"
    end

    def repository_url(content_path, content_type = 'repos', 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
      content_path = content_path.sub(%r|^/|, '')
      if @host.content_view && !@host.content_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_type}/#{path}"
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.18.5 app/helpers/katello/katello_urls_helper.rb
katello-3.18.4 app/helpers/katello/katello_urls_helper.rb
katello-3.18.3.1 app/helpers/katello/katello_urls_helper.rb
katello-3.18.3 app/helpers/katello/katello_urls_helper.rb
katello-4.0.0.rc3.1 app/helpers/katello/katello_urls_helper.rb
katello-4.0.0.rc3 app/helpers/katello/katello_urls_helper.rb
katello-3.18.2.1 app/helpers/katello/katello_urls_helper.rb
katello-3.18.2 app/helpers/katello/katello_urls_helper.rb
katello-4.0.0.rc2 app/helpers/katello/katello_urls_helper.rb
katello-3.18.1.1 app/helpers/katello/katello_urls_helper.rb
katello-4.0.0.rc1 app/helpers/katello/katello_urls_helper.rb
katello-3.18.1 app/helpers/katello/katello_urls_helper.rb
katello-3.18.0 app/helpers/katello/katello_urls_helper.rb
katello-3.18.0.rc2.1 app/helpers/katello/katello_urls_helper.rb
katello-3.18.0.rc2 app/helpers/katello/katello_urls_helper.rb
katello-3.18.0.rc1 app/helpers/katello/katello_urls_helper.rb