class PackerFiles::Fedora::CD

Public Instance Methods

get_check_sum_pattern() click to toggle source

Override method for getting checksums

# File lib/PackerFiles/OS/RHEL/FedoraCD.rb, line 21
def get_check_sum_pattern
   'Fedora-@release@-@arch@-CHECKSUM'
end
get_check_sum_type() click to toggle source

Override method for checksum type

# File lib/PackerFiles/OS/RHEL/FedoraCD.rb, line 26
def get_check_sum_type
   'sha256'
end
get_iso_name_pattern() click to toggle source

Override method for getting the ISO name

# File lib/PackerFiles/OS/RHEL/FedoraCD.rb, line 16
def get_iso_name_pattern
   'Fedora-@release@-@arch@-DVD.iso'
end
index_urls() click to toggle source

Override method for getting index URLs. This is a dummy URL which is not accessible.

# File lib/PackerFiles/OS/RHEL/FedoraCD.rb, line 32
def index_urls
   default_urls + mirror_index_urls
end

Private Instance Methods

default_urls() click to toggle source

Master URL list for fedora.

# File lib/PackerFiles/OS/RHEL/FedoraCD.rb, line 38
def default_urls
[
'https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/@release@/Fedora/@arch@/iso/',
'https://archives.fedoraproject.org/pub/fedora/linux/releases/@release@/Fedora/@arch@/iso/'
]
end
mirror_index_urls() click to toggle source

List of Mirror URLs for Fedora. We use nokogiri to parse values from the Index URL and try to find a matching mirror for a given country.Since we are doing HTML Parsing the code below is found to fail sometime.

# File lib/PackerFiles/OS/RHEL/FedoraCD.rb, line 49
def mirror_index_urls
   page    = Nokogiri::HTML(open(@@index))
   country = Utils::AutoZone.new.JSON['country_code']
   set     = page.css('td').select {|td| td.text.end_with?(country)}
   urls    = set.map {|node|
      rows  = node.parent.css('td[4]/table/tr')
      row   = rows.select{|row| row.css('td[1]').text.match('Fedora Linux|Archive')}
      if !row.empty?
         links = row.map {|e| e.css('a').map {|link| link['href']}}.flatten.compact
         links.select {|link| link.start_with?('http')}
      end
   }.flatten
   urls.map {|url|
      url + '/releases/@release@/Fedora/@arch@/iso/'
   }

end