Module: Katello::KatelloUrlsHelper
- Extended by:
- ApipieDSL::Module
- Included in:
- Concerns::HostManagedExtensions
- Defined in:
- app/helpers/katello/katello_urls_helper.rb
Instance Method Summary collapse
- #foreman_settings_url(schema = 'http') ⇒ Object
- #repository_url(content_path, _content_type = nil, schema = 'http') ⇒ Object
- #subscription_manager_configuration_url(host = nil, rpm = true, hostname: nil) ⇒ Object
Instance Method Details
#foreman_settings_url(schema = 'http') ⇒ Object
16 17 18 |
# File 'app/helpers/katello/katello_urls_helper.rb', line 16 def foreman_settings_url(schema = 'http') ::Setting[:foreman_url].sub(%r|^.*?:|, "#{schema}:") end |
#repository_url(content_path, _content_type = nil, schema = 'http') ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/helpers/katello/katello_urls_helper.rb', line 46 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 content_path = content_path.sub(%r|^/|, '') lifecycle_environment = nil if @host.default_environment? # Don't update the content_path if the host is using the default org view / library lifecycle_environment = ::Katello::KTEnvironment.library.find_by(organization_id: @host.organization_id) elsif !@host.single_content_view_environment? fail ::Katello::Errors::MultiEnvironmentNotSupportedError, "Host #{@host.name} must be subscribed to only a single content view & environment or subscribe to the default organization content view for liveimg provisioning." else lifecycle_environment = @host.single_lifecycle_environment content_path = [@host.single_content_view.label, content_path].join('/') end path = ::Katello::Repository.repo_path_from_content_path( lifecycle_environment, content_path) "#{url}/pulp/content/#{path}" end |
#subscription_manager_configuration_url(host = nil, rpm = true, hostname: nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/katello/katello_urls_helper.rb', line 26 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 |