foreman/app/models/redhat.rb @ b22b6fe7
2c83f744 | Paul Kelly | class Redhat < Operatingsystem
|
|
0f77c7f2 | Ohad Levy | ||
PXEFILES = {:kernel => "vmlinuz", :initrd => "initrd.img"}
|
|||
db59a916 | Jochen Schalanda | # outputs kickstart installation medium based on the medium type (NFS or URL)
|
|
2c83f744 | Paul Kelly | # it also convert the $arch string to the current host architecture
|
|
db59a916 | Jochen Schalanda | def mediumpath host
|
|
017e1049 | Ohad Levy | uri = medium_uri(host)
|
|
2c83f744 | Paul Kelly | ||
case uri.scheme
|
|||
when 'http', 'https', 'ftp'
|
|||
017e1049 | Ohad Levy | "url --url #{uri}"
|
|
2c83f744 | Paul Kelly | else
|
|
017e1049 | Ohad Levy | server = uri.select(:host, :port).compact.join(':')
|
|
dir = uri.select(:path, :query).compact.join('?')
|
|||
2c83f744 | Paul Kelly | "nfs --server #{server} --dir #{dir}"
|
|
end
|
|||
end
|
|||
# installs the epel repo
|
|||
def epel host
|
|||
b22b6fe7 | Sam Kottler | epel_url = "http://dl.fedoraproject.org/pub/epel/$major/$arch/epel-release-$os.noarch.rpm"
|
|
2c83f744 | Paul Kelly | ||
case host.operatingsystem.major
|
|||
when "4"
|
|||
f04c53f5 | Ohad Levy | epel_url.gsub!("$os","4-10")
|
|
2c83f744 | Paul Kelly | when "5"
|
|
f04c53f5 | Ohad Levy | epel_url.gsub!("$os","5-4")
|
|
2c83f744 | Paul Kelly | when "6"
|
|
9d0aee7f | Jim Perrin | epel_url.gsub!("$os","6-5")
|
|
2c83f744 | Paul Kelly | else
|
|
return ""
|
|||
end
|
|||
67799065 | Ohad Levy | "su -c 'rpm -Uvh #{medium_uri(host, epel_url)}'"
|
|
2c83f744 | Paul Kelly | end
|
|
def yumrepo host
|
|||
if host.respond_to? :yumrepo
|
|||
"--enablerepo #{repo}"
|
|||
end
|
|||
end
|
|||
3b828aad | Ohad Levy | # Override the class representation, as this breaks many rails helpers
|
|
def class
|
|||
Operatingsystem
|
|||
end
|
|||
a6db0470 | Paul Kelly | # The PXE type to use when generating actions and evaluating attributes. jumpstart, kickstart and preseed are currently supported.
|
|
0f77c7f2 | Ohad Levy | def pxe_type
|
|
"kickstart"
|
|||
end
|
|||
a6db0470 | Paul Kelly | def pxedir
|
|
"images/pxeboot"
|
|||
end
|
|||
14dd0353 | Ohad Levy | def url_for_boot(file)
|
|
a6db0470 | Paul Kelly | pxedir + "/" + PXEFILES[file]
|
|
14dd0353 | Ohad Levy | end
|
|
3b828aad | Ohad Levy | end
|