Sha256: 7efc140f5ac6540f64b2148f0828fc9d5b2e8757b813cc769aa4333020b0ea18

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

class Redhat < Operatingsystem

  PXEFILES = {:kernel => "vmlinuz", :initrd => "initrd.img"}

  # outputs kickstart installation medium based on the medium type (NFS or URL)
  # it also convert the $arch string to the current host architecture
  def mediumpath host
    uri    = medium_uri(host)

    case uri.scheme
      when 'http', 'https', 'ftp'
         "url --url #{uri}"
      else
        server = uri.select(:host, :port).compact.join(':')
        dir    = uri.select(:path, :query).compact.join('?')
        "nfs --server #{server} --dir #{dir}"
    end
  end

  # installs the epel repo
  def epel host
    epel_url = "http://dl.fedoraproject.org/pub/epel/$major/$arch/epel-release-$os.noarch.rpm"

    case host.operatingsystem.major
    when "4"
      epel_url.gsub!("$os","4-10")
    when "5"
      epel_url.gsub!("$os","5-4")
    when "6"
       epel_url.gsub!("$os","6-8")
    else
      return ""
    end
    "su -c 'rpm -Uvh #{medium_uri(host, epel_url)}'"
  end

  def yumrepo host
    if host.respond_to? :yumrepo
      "--enablerepo #{repo}"
    end
  end

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

  # The PXE type to use when generating actions and evaluating attributes. jumpstart, kickstart and preseed are currently supported.
  def pxe_type
    "kickstart"
  end

  def pxedir
    "images/pxeboot"
  end

  def url_for_boot(file)
    pxedir + "/" + PXEFILES[file]
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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