Class: UnattendedController

Inherits:
ApplicationController show all
Defined in:
app/controllers/unattended_controller.rb

Constant Summary collapse

PXE_CONFIG_URLS =

Methods which return configuration files for syslinux(pxe), pxegrub or g/ipxe

[:pxe_kickstart_config, :pxe_debian_config, :pxemenu] + TemplateKind.where("name LIKE ?","pxelinux").map(&:name)
PXEGRUB_CONFIG_URLS =
[:pxe_jumpstart_config] + TemplateKind.where("name LIKE ?", "pxegrub").map(&:name)
GPXE_CONFIG_URLS =
[:gpxe_kickstart_config] + TemplateKind.where("name LIKE ?", "gpxe").map(&:name)
CONFIG_URLS =
PXE_CONFIG_URLS + GPXE_CONFIG_URLS + PXEGRUB_CONFIG_URLS
PROVISION_URLS =

Methods which return valid provision instructions, used by the OS

[:kickstart, :preseed, :jumpstart ] + TemplateKind.where("name LIKE ?", "provision").map(&:name)
FINISH_URLS =

Methods which returns post install instructions for OS's which require it

[:preseed_finish, :jumpstart_finish] + TemplateKind.where("name LIKE ?", "finish").map(&:name)
FILTERS =

We dont require any of these methods for provisioning

[:require_ssl, :require_login, :session_expiry, :update_activity_time, :set_taxonomy, :authorize]

Instance Method Summary collapse

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#builtObject

this actions is called by each operatingsystem post/finish script - it notify us that the OS installation is done.


46
47
48
49
# File 'app/controllers/unattended_controller.rb', line 46

def built
  logger.info "#{controller_name}: #{@host.name} is Built!"
  head(@host.built ? :created : :conflict)
end

#gpxe_kickstart_configObject

Returns a valid GPXE config file to kickstart hosts


64
65
# File 'app/controllers/unattended_controller.rb', line 64

def gpxe_kickstart_config
end

#kickstartObject


33
34
35
# File 'app/controllers/unattended_controller.rb', line 33

def kickstart
  unattended_local
end

#preseedObject


37
38
39
# File 'app/controllers/unattended_controller.rb', line 37

def preseed
  unattended_local
end

#preseed_finishObject


41
42
43
# File 'app/controllers/unattended_controller.rb', line 41

def preseed_finish
  unattended_local
end

#pxe_configObject


67
68
69
70
# File 'app/controllers/unattended_controller.rb', line 67

def pxe_config
  @kernel = @host.operatingsystem.kernel @host.arch
  @initrd = @host.operatingsystem.initrd @host.arch
end

#templateObject


51
52
53
54
55
56
57
58
59
60
61
# File 'app/controllers/unattended_controller.rb', line 51

def template
  return head(:not_found) unless (params.has_key?("id") and params.has_key?(:hostgroup))

  template = ConfigTemplate.find_by_name(params['id'])
  @host = Hostgroup.find_by_name(params['hostgroup'])

  return head(:not_found) unless template and @host

  load_template_vars if template.template_kind.name == 'provision'
  safe_render template.template
end