Class: Katello::PxeFilesDownloader

Inherits:
Object
  • Object
show all
Defined in:
app/services/katello/pxe_files_downloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository, capsule) ⇒ PxeFilesDownloader

Returns a new instance of PxeFilesDownloader.



5
6
7
8
# File 'app/services/katello/pxe_files_downloader.rb', line 5

def initialize(repository, capsule)
  @capsule = capsule
  @repository = repository
end

Instance Attribute Details

#capsuleObject

Returns the value of attribute capsule.



3
4
5
# File 'app/services/katello/pxe_files_downloader.rb', line 3

def capsule
  @capsule
end

#repositoryObject

Returns the value of attribute repository.



3
4
5
# File 'app/services/katello/pxe_files_downloader.rb', line 3

def repository
  @repository
end

Instance Method Details

#download_filesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/katello/pxe_files_downloader.rb', line 10

def download_files
  os = Redhat.find_or_create_operating_system(repository)
  medium_provider = Katello::ManagedContentMediumProvider.new(
    OpenStruct.new(
      content_source: capsule,
      kickstart_repository: repository))

  ueber_cert = ::Cert::Certs.ueber_cert(repository.organization)
  cert = OpenSSL::X509::Certificate.new(ueber_cert[:cert])
  key = OpenSSL::PKey::RSA.new(ueber_cert[:key])

  os.boot_file_sources(medium_provider).values.map do |source_pxe_file|
    fetch(source_pxe_file, cert, key)
  end
end