Sha256: 997225239426773ef72a88a16e8f43181982ea8c5763f5d0da0b8095fb8b8c48

Contents?: true

Size: 1.22 KB

Versions: 23

Compression:

Stored size: 1.22 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)
      prefix = if 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

23 entries across 23 versions & 1 rubygems

Version Path
katello-3.17.3 app/helpers/katello/katello_urls_helper.rb
katello-3.17.2 app/helpers/katello/katello_urls_helper.rb
katello-3.17.1 app/helpers/katello/katello_urls_helper.rb
katello-3.16.2 app/helpers/katello/katello_urls_helper.rb
katello-3.17.0 app/helpers/katello/katello_urls_helper.rb
katello-3.17.0.rc2.2 app/helpers/katello/katello_urls_helper.rb
katello-3.17.0.rc2.1 app/helpers/katello/katello_urls_helper.rb
katello-3.16.1.2 app/helpers/katello/katello_urls_helper.rb
katello-3.16.1.1 app/helpers/katello/katello_urls_helper.rb
katello-3.17.0.rc2 app/helpers/katello/katello_urls_helper.rb
katello-3.16.1 app/helpers/katello/katello_urls_helper.rb
katello-3.17.0.rc1 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0.rc5.1 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0.rc5 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0.rc4.1 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0.rc4 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0.rc3.1 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0.rc3 app/helpers/katello/katello_urls_helper.rb
katello-3.16.0.rc2.1 app/helpers/katello/katello_urls_helper.rb