Sha256: a5bd9b464a24ccde4ce56f2d7c44414126e689bba0252ec322b37b930eddbfa2

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'uri'

module ForemanBootdisk
  module HostExt
    def bootdisk_template
      template = ProvisioningTemplate.unscoped.find_by(
        name: Setting[:bootdisk_host_template]
      )
      unless template
        raise ::Foreman::Exception.new(
          N_('Unable to find template specified by %s setting'), 'bootdisk_host_template'
        )
      end
      template
    end

    def bootdisk_template_render
      ForemanBootdisk::Renderer.new.render_template(template: bootdisk_template, host: self)
    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? && SETTINGS[:unattended] && bootdisk_build? && !build?)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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