Sha256: 8851aec38b90f5a280a4440fb8766355c15834f6a20d4ebafba763429318c568

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

require 'uri'

module ForemanBootdisk::HostExt
  extend ActiveSupport::Concerns

  def bootdisk_template
    ConfigTemplate.find_by_name(Setting[:bootdisk_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_host_template'))
  end

  def bootdisk_template_render
    if (Gem::Version.new(SETTINGS[:version].notag) < Gem::Version.new('1.5')) && Setting[:safemode_render]
      raise(::Foreman::Exception.new(N_('Bootdisk is not supported with safemode rendering, please disable safemode_render under Adminster>Settings')))
    end

    @host = self
    pxe_render(bootdisk_template.template)
  end

  def bootdisk_chain_url(mac = self.mac, action = 'iPXE')
    u = URI.parse(foreman_url(action))
    u.query = "#{u.query}&mac=#{mac}"
    u.fragment = nil
    u.to_s
  end

  def bootdisk_raise(*args)
    raise ::Foreman::Exception.new(*args)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_bootdisk-3.1.2 app/models/concerns/foreman_bootdisk/host_ext.rb
foreman_bootdisk-3.1.1 app/models/concerns/foreman_bootdisk/host_ext.rb
foreman_bootdisk-3.1.0 app/models/concerns/foreman_bootdisk/host_ext.rb
foreman_bootdisk-3.0.0 app/models/concerns/foreman_bootdisk/host_ext.rb