Project

General

Profile

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
1 1
class UnattendedController < ApplicationController
2 2
  layout nil
3 3
  helper :all
4
  before_filter :get_host_details, :allowed_to_install?, :except => :pxe_kickstart_config
5
  before_filter :handle_ca, :except => [:jumpstart_finish, :preseed_finish, :pxe_kickstart_config]
4
  before_filter :get_host_details, :allowed_to_install?, :except => [:pxe_kickstart_config, :pxe_debian_config]
5
  before_filter :handle_ca, :except => [:jumpstart_finish, :preseed_finish, :pxe_kickstart_config, :pxe_debian_config]
6 6
  skip_before_filter :require_ssl, :require_login
7 7
  after_filter :set_content_type, :only => [:kickstart, :preseed, :preseed_finish,
8
    :jumpstart_profile, :jumpstart_finish, :pxe_kickstart_config]
8
    :jumpstart_profile, :jumpstart_finish, :pxe_kickstart_config, :pxe_debian_config]
9 9

  
10 10
  def kickstart
11 11
    logger.info "#{controller_name}: Kickstart host #{@host.name}"
......
51 51
    @initrd = "#{prefix}-#{Redhat::PXEFILES[:initrd]}"
52 52
  end
53 53

  
54
  def pxe_debian_config
55
    @host = Host.find_by_name params[:host_id]
56
    prefix = @host.operatingsystem.pxe_prefix(@host.arch)
57
    @kernel = "#{prefix}-#{Debian::PXEFILES[:kernel]}"
58
    @initrd = "#{prefix}-#{Debian::PXEFILES[:initrd]}"
59
  end
60

  
54 61
  private
55 62
  # lookup for a host based on the ip address and if possible by a mac address(as sent by anaconda)
56 63
  # if the host was found than its record will be in @host
app/models/debian.rb
1 1
class Debian < Operatingsystem
2

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

  
2 5
  def preseed_server host
3 6
    media_uri(host).select(:host, :port).compact.join(':')
4 7
  end
......
12 15
    Operatingsystem
13 16
  end
14 17

  
18
  def boot_files_uri(media, architecture)
19
    raise "invalid media for #{to_s}" unless medias.include?(media)
20
    raise "invalid architecture for #{to_s}" unless architectures.include?(architecture)
21

  
22
    pxe_dir = "dists/#{release_name}/main/installer-#{architecture}/current/images/netboot/ubuntu-installer/#{architecture}"
23

  
24
    PXEFILES.values.collect do |img|
25
      URI.parse("#{media_vars_to_uri(media.path, architecture.name, self)}/#{pxe_dir}/#{img}").normalize
26
    end
27
  end
28

  
29
  def pxe_type
30
    "debian"
31
  end
32

  
15 33
end
app/views/unattended/pxe_debian_config.erb
1
default linux
2
label linux
3
kernel <%= @kernel %>
4
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
0
-