Sha256: d2ebd593b4d3cd98cee74e4c508f8ca364899336f3f5a3e1577de0f659182d09

Contents?: true

Size: 1.23 KB

Versions: 55

Compression:

Stored size: 1.23 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 && 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

55 entries across 55 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/helpers/katello/katello_urls_helper.rb
katello-3.15.3 app/helpers/katello/katello_urls_helper.rb
katello-3.15.2 app/helpers/katello/katello_urls_helper.rb
katello-3.15.1.1 app/helpers/katello/katello_urls_helper.rb
katello-3.15.1 app/helpers/katello/katello_urls_helper.rb
katello-3.15.0.1 app/helpers/katello/katello_urls_helper.rb
katello-3.15.0 app/helpers/katello/katello_urls_helper.rb
katello-3.15.0.rc2 app/helpers/katello/katello_urls_helper.rb
katello-3.15.0.rc1.3 app/helpers/katello/katello_urls_helper.rb
katello-3.15.0.rc1.2 app/helpers/katello/katello_urls_helper.rb
katello-3.15.0.rc1.1 app/helpers/katello/katello_urls_helper.rb
katello-3.15.0.rc1 app/helpers/katello/katello_urls_helper.rb
katello-3.14.1 app/helpers/katello/katello_urls_helper.rb
katello-3.13.4 app/helpers/katello/katello_urls_helper.rb
katello-3.14.0 app/helpers/katello/katello_urls_helper.rb
katello-3.13.3 app/helpers/katello/katello_urls_helper.rb
katello-3.14.0.rc2 app/helpers/katello/katello_urls_helper.rb
katello-3.13.2 app/helpers/katello/katello_urls_helper.rb
katello-3.14.0.rc1 app/helpers/katello/katello_urls_helper.rb
katello-3.13.1 app/helpers/katello/katello_urls_helper.rb