Project

General

Profile

« Previous | Next » 

Revision c289176c

Added by Ohad Levy about 14 years ago

  • ID c289176c6e4936c79ab0649a421188d9ed2d3bb3

fixes #237 - installing puppet from epel breaks if base image is not 5.3 or 4.9 release

View differences:

app/controllers/unattended_controller.rb
os = @host.operatingsystem
@osver = os.major.to_i
@mediapath = os.mediapath @host
@epel = os.epel @arch
@epel = os.epel @host
@yumrepo = os.yumrepo @host
unattended_local "kickstart"
end
app/models/operatingsystem.rb
to_label
end
def to_version
"#{major}#{('-' + minor) unless minor.empty?}"
end
def fullname
"#{name}_#{to_version}"
to_label
end
private
lib/family.rb
FAMILIES.map{|e| OpenStruct.new(:name => e, :value => FAMILIES.index(e)) }
end
def media_uri host
URI.parse(host.media.path.gsub('$arch',host.architecture.name).
gsub('$major', host.os.major).
gsub('$minor', host.os.minor).
gsub('$version', [ host.os.major, host.os.minor ].compact.join('.'))
).normalize
def media_uri host, url = nil
url ||= host.media.path
URI.parse(url.gsub('$arch',host.architecture.name).
gsub('$major', host.os.major).
gsub('$minor', host.os.minor).
gsub('$version', [ host.os.major, host.os.minor ].compact.join('.'))
).normalize
end
module Debian
......
end
end
def epel arch
["4","5"].include?(major) ? "su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/#{major}/#{arch}/epel-release-#{to_version}.noarch.rpm'" : ""
# installs the epel repo
def epel host
epel_url = "http://download.fedora.redhat.com/pub/epel/$major/$arch/epel-release-$os.noarch.rpm"
case host.operatingsystem.major
when "4"
epel_url.gsub!("$os","4-9")
when "5"
epel_url.gsub!("$os","5-3")
else
return ""
end
return "su -c 'rpm -Uvh #{media_uri(host, epel_url)}"
end
def yumrepo host
test/unit/operatingsystem_test.rb
assert operating_system.to_label == "Ubuntu 9.10"
end
test "to_version should print correctly" do
operating_system = Operatingsystem.new :name => "Ubuntu", :major => "9", :minor => "10"
assert operating_system.to_version == "9-10"
end
test "fullname should print correctly" do
operating_system = Operatingsystem.new :name => "Ubuntu", :major => "9", :minor => "10"
assert operating_system.fullname == "Ubuntu_9-10"
end
test "to_s retrives label" do
operating_system = Operatingsystem.new :name => "Ubuntu", :major => "9", :minor => "10"
assert operating_system.to_s == operating_system.to_label

Also available in: Unified diff