Project

General

Profile

Feature #178 » 0001-Added-support-for-Debian-based-distributions-for-aut.patch

Jochen Schalanda, 10/17/2010 02:09 PM

View differences:

app/controllers/unattended_controller.rb
class UnattendedController < ApplicationController
layout nil
helper :all
before_filter :get_host_details, :allowed_to_install?, :except => :pxe_kickstart_config
before_filter :handle_ca, :except => [:jumpstart_finish, :preseed_finish, :pxe_kickstart_config]
before_filter :get_host_details, :allowed_to_install?, :except => [:pxe_kickstart_config, :pxe_debian_config]
before_filter :handle_ca, :except => [:jumpstart_finish, :preseed_finish, :pxe_kickstart_config, :pxe_debian_config]
skip_before_filter :require_ssl, :require_login
after_filter :set_content_type, :only => [:kickstart, :preseed, :preseed_finish,
:jumpstart_profile, :jumpstart_finish, :pxe_kickstart_config]
:jumpstart_profile, :jumpstart_finish, :pxe_kickstart_config, :pxe_debian_config]
def kickstart
logger.info "#{controller_name}: Kickstart host #{@host.name}"
......
@initrd = "#{prefix}-#{Redhat::PXEFILES[:initrd]}"
end
def pxe_debian_config
@host = Host.find_by_name params[:host_id]
prefix = @host.operatingsystem.pxe_prefix(@host.arch)
@kernel = "#{prefix}-#{Debian::PXEFILES[:kernel]}"
@initrd = "#{prefix}-#{Debian::PXEFILES[:initrd]}"
end
private
# lookup for a host based on the ip address and if possible by a mac address(as sent by anaconda)
# if the host was found than its record will be in @host
app/models/debian.rb
class Debian < Operatingsystem
PXEFILES = {:kernel => "linux", :initrd => "initrd.gz"}
def preseed_server host
media_uri(host).select(:host, :port).compact.join(':')
end
......
Operatingsystem
end
def boot_files_uri(media, architecture)
raise "invalid media for #{to_s}" unless medias.include?(media)
raise "invalid architecture for #{to_s}" unless architectures.include?(architecture)
pxe_dir = "dists/#{release_name}/main/installer-#{architecture}/current/images/netboot/ubuntu-installer/#{architecture}"
PXEFILES.values.collect do |img|
URI.parse("#{media_vars_to_uri(media.path, architecture.name, self)}/#{pxe_dir}/#{img}").normalize
end
end
def pxe_type
"debian"
end
end
app/views/unattended/pxe_debian_config.erb
default linux
label linux
kernel <%= @kernel %>
append initrd=<%= @initrd %> interface=auto url=<%= foreman_url("preseed")%> ramdisk_size=10800 root=/dev/rd/0 rw auto hostname=unassigned-hostname locale=en_US console-setup/ask_detect=false console-setup/layout=USA console-setup/variant=USA
(2-2/2)