Sha256: 6d10e741b51d8d09338367782f8be54231931914aa54f2d8535a6ad82c09fa99

Contents?: true

Size: 811 Bytes

Versions: 6

Compression:

Stored size: 811 Bytes

Contents

module Bootdisk::HostsControllerExt
  extend ActiveSupport::Concern

  included do
    alias_method :find_by_name_bootiso, :find_by_name
    before_filter :find_by_name_bootiso, :only => %w[bootdisk_iso]
    alias_method_chain :current_permission, :bootdisk if method_defined?(:current_permission)
  end

  def bootdisk_iso
    begin
      tmpl = @host.bootdisk_template_render
    rescue => e
      error _('Failed to render boot disk template: %s') % e
      redirect_to :back
      return
    end

    Bootdisk::ISOGenerator.new(tmpl).generate do |iso|
      send_data File.read(iso), :filename => "#{@host.name}.iso"
    end
  end

  def current_permission_with_bootdisk
    if params[:action] == 'bootdisk_iso'
      'download_bootdisk'
    else
      current_permission_without_bootdisk
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_bootdisk-2.0.8 app/controllers/concerns/bootdisk/hosts_controller_ext.rb
foreman_bootdisk-2.0.7 app/controllers/concerns/bootdisk/hosts_controller_ext.rb
foreman_bootdisk-2.0.6 app/controllers/concerns/bootdisk/hosts_controller_ext.rb
foreman_bootdisk-2.0.5 app/controllers/concerns/bootdisk/hosts_controller_ext.rb
foreman_bootdisk-2.0.4 app/controllers/concerns/bootdisk/hosts_controller_ext.rb
foreman_bootdisk-2.0.3 app/controllers/concerns/bootdisk/hosts_controller_ext.rb