Module: ForemanWds::UnattendedControllerExtensions

Defined in:
app/controllers/concerns/foreman_wds/unattended_controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#render_template(kind) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/concerns/foreman_wds/unattended_controller_extensions.rb', line 3

def render_template(kind)
  return super unless kind == 'wds_localboot'

  iface = @host.provision_interface

  # Deploy regular DHCP and local boot TFTP
  @host.provision_method = 'build'
  @host.build = false
  iface.send :rebuild_tftp
  iface.send :rebuild_dhcp

  render inline: "Success. Local boot template was deployed successfully.\n"
rescue StandardError => e
  message = format('Failed to set local boot template: %{error}', error: e)
  logger.error message
  render text: message, status: :error, content_type: 'text/plain'
end