Sha256: a66705f9538f77687b0efec561197a5ba3bd65d9dfcaf8f832182e9dcecfc8be

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

class Debian < Operatingsystem

  PXEFILES = {:kernel => "linux", :initrd => "initrd.gz"}

  def preseed_server host
    medium_uri(host).select(:host, :port).compact.join(':')
  end

  def preseed_path host
    medium_uri(host).select(:path, :query).compact.join('?')
  end

  # Override the class representation, as this breaks many rails helpers
  def class
    Operatingsystem
  end

  def boot_files_uri(medium, architecture)
    raise ::Foreman::Exception(N_("invalid medium for %s"), to_s) unless media.include?(medium)
    raise ::Foreman::Exception(N_("invalid architecture for %s"), to_s) unless architectures.include?(architecture)

    # Debian stores x86_64 arch is amd64
    arch = architecture.to_s.gsub("x86_64","amd64")
    pxe_dir = "dists/#{release_name}/main/installer-#{arch}/current/images/netboot/#{guess_os}-installer/#{arch}"

    PXEFILES.values.collect do |img|
      URI.parse("#{medium_vars_to_uri(medium.path, architecture.name, self)}/#{pxe_dir}/#{img}").normalize
    end
  end

  def pxe_type
    "preseed"
  end

  # Does this OS family use release_name in its naming scheme
  def use_release_name?
    true
  end

  private

  # tries to guess if this an ubuntu or a debian os
  def guess_os
    name =~ /ubuntu/i ? "ubuntu" : "debian"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/models/debian.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/models/debian.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/models/debian.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/models/debian.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/models/debian.rb