Sha256: 66741d0e84d9d953c3a9eb206044b602a36ba21ad667a5e0e99b09d8cd4c3281

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

require 'uri'

module ForemanBootdisk::HostExt
  def bootdisk_template
    ProvisioningTemplate.unscoped.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
    @host = self
    unattended_render(bootdisk_template.template)
  end

  def bootdisk_chain_url(mac = self.mac, action = 'iPXE')
    ForemanBootdisk::Renderer.format_bootdisk_chain_url(foreman_url(action), mac)
  end

  def bootdisk_build?
    provision_method == 'bootdisk'
  end

  def bootdisk?
    managed? && bootdisk_build? && SETTINGS[:unattended]
  end

  def bootdisk_downloadable?
    architecture.blank? || intel_arch?
  end

  def intel_arch?
    /i.86|x86[_-]64/ =~ architecture.name
  end

  def validate_media?
    super || (managed && bootdisk_build? && build?)
  end

  def can_be_built?
    super || (managed? and SETTINGS[:unattended] and bootdisk_build? and !build?)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_bootdisk-11.0.0 app/models/concerns/foreman_bootdisk/host_ext.rb