Sha256: cb2172a1afae82088bb934538d2ee9a3453c19a93c96812dbc540d35f9ccf2e9

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

module Katello
  class ManagedContentMediumProvider < ::MediumProviders::Provider
    def validate
      errors = []

      errors << N_("Kickstart repository was not set for host '%{host}'") % { :host => entity } if kickstart_repo.nil?
      errors << N_("Content source was not set for host '%{host}'") % { :host => entity } if entity.content_source.nil?
      errors
    end

    def medium_uri(path = "")
      url = kickstart_repo.full_path(entity.content_source, true)
      url += '/' + path unless path.empty?
      URI.parse(url)
    end

    # If there are any 'AppStream' variants, we need to make them
    # available to Anaconda
    def additional_media
      appstream_repos = entity.operatingsystem.variant_repos(entity, 'AppStream')
      super + (appstream_repos.present? ? appstream_repos : [])
    end

    def unique_id
      @unique_id ||= begin
        "#{kickstart_repo.name.parameterize}-#{kickstart_repo.id}"
      end
    end

    def kickstart_repo
      @kickstart_repo ||= entity.try(:content_facet).try(:kickstart_repository) || entity.try(:kickstart_repository)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
katello-4.0.3 app/services/katello/managed_content_medium_provider.rb
katello-4.0.2.1 app/services/katello/managed_content_medium_provider.rb
katello-4.0.2 app/services/katello/managed_content_medium_provider.rb
katello-4.0.1.2 app/services/katello/managed_content_medium_provider.rb
katello-4.0.1.1 app/services/katello/managed_content_medium_provider.rb
katello-4.0.1 app/services/katello/managed_content_medium_provider.rb