Class: ForemanBootdisk::DisksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanBootdisk::DisksController
- Includes:
- AllowedActions, PrettyError
- Defined in:
- app/controllers/foreman_bootdisk/disks_controller.rb
Instance Method Summary collapse
Methods included from AllowedActions
Instance Method Details
#bootdisk_options ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/controllers/foreman_bootdisk/disks_controller.rb', line 70 def host = @disk return not_found unless host respond_to do |format| format.json do render json: { bootdiskOptions: { bootdiskDownloadable: !!host&.bootdisk_downloadable?, architectureName: host&.architecture&.name, actions: bootdisk_allowed_actions(host), }, }, status: :ok end end end |
#full_host ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/foreman_bootdisk/disks_controller.rb', line 53 def full_host host = @disk prolong_token(host) begin ForemanBootdisk::ISOGenerator.generate_full_host(host) do |iso| send_file(iso, filename: "#{host.name}#{ForemanBootdisk::ISOGenerator.token_expiry(host)}.iso") end rescue ::Foreman::Exception => e raise e unless e.code == 'ERF42-2893' error _('Host is not in build mode.') redirect_back(fallback_location: '/') end end |
#generic ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/foreman_bootdisk/disks_controller.rb', line 20 def generic begin # EFI not supported for iPXE generic bootdisk tmpl = ForemanBootdisk::Renderer.new.generic_template_render rescue StandardError => e error_rendering(e) redirect_back(fallback_location: '/') return end ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso| send_file(iso, filename: "bootdisk_#{URI.parse(Setting[:foreman_url]).host}.iso") end end |
#help ⇒ Object
68 |
# File 'app/controllers/foreman_bootdisk/disks_controller.rb', line 68 def help; end |
#host ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/foreman_bootdisk/disks_controller.rb', line 35 def host host = @disk begin # EFI not supported for iPXE host bootdisk tmpl = host.bootdisk_template_render rescue StandardError => e error_rendering(e) redirect_back(fallback_location: '/') return end prolong_token(host) ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso| send_file(iso, filename: "#{host.name}.iso") end end |