Class: ForemanBootdisk::Api::V2::SubnetDisksController

Inherits:
Api::V2::BaseController
  • Object
show all
Includes:
AllowedActions, Api::Version2
Defined in:
app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb

Instance Method Summary collapse

Methods included from AllowedActions

#bootdisk_type_allowed?

Instance Method Details

#indexObject



20
# File 'app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb', line 20

def index; end

#subnetObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb', line 24

def subnet
  subnet = @subnet_disk
  subnet.tftp || raise(::Foreman::Exception.new(N_('TFTP feature not enabled for subnet %s'), subnet.name))
  tmpl_bios = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
  tmpl_efi = nil
  if subnet.httpboot
    tmpl_efi = ForemanBootdisk::Renderer.new.generic_efi_template_render(subnet)
  else
    ForemanBootdisk.logger.warn('HTTPBOOT feature is not enabled for subnet %s, UEFI may not be available for bootdisk' % subnet.name)
  end
  ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl_bios, grub: tmpl_efi) do |temp_iso_filename|
    send_file(temp_iso_filename, filename: subnet.name)
  end
end