Class: Katello::ManagedContentMediumProvider

Inherits:
MediumProviders::Provider
  • Object
show all
Defined in:
app/services/katello/managed_content_medium_provider.rb

Instance Method Summary collapse

Instance Method Details

#additional_mediaObject

If there are any ‘AppStream’ variants, we need to make them available to Anaconda



19
20
21
22
# File 'app/services/katello/managed_content_medium_provider.rb', line 19

def additional_media
  appstream_repos = entity.operatingsystem.variant_repos(entity, 'AppStream')
  super + (appstream_repos.present? ? appstream_repos : [])
end

#architecture_nameObject



34
35
36
# File 'app/services/katello/managed_content_medium_provider.rb', line 34

def architecture_name
  kickstart_repo.try(:distribution_arch)
end

#kickstart_repoObject



30
31
32
# File 'app/services/katello/managed_content_medium_provider.rb', line 30

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

#medium_uri(path = "") ⇒ Object



11
12
13
14
15
# File 'app/services/katello/managed_content_medium_provider.rb', line 11

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

#unique_idObject



24
25
26
27
28
# File 'app/services/katello/managed_content_medium_provider.rb', line 24

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

#validateObject



3
4
5
6
7
8
9
# File 'app/services/katello/managed_content_medium_provider.rb', line 3

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