Module: ForemanBootdisk::HostExt

Extended by:
ApipieDSL::Extension
Defined in:
app/models/concerns/foreman_bootdisk/host_ext.rb

Instance Method Summary collapse

Instance Method Details

#bootdisk?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/concerns/foreman_bootdisk/host_ext.rb', line 26

def bootdisk?
  managed? && bootdisk_build?
end

#bootdisk_build?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/models/concerns/foreman_bootdisk/host_ext.rb', line 22

def bootdisk_build?
  provision_method == 'bootdisk'
end

#bootdisk_downloadable?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/models/concerns/foreman_bootdisk/host_ext.rb', line 30

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

#bootdisk_templateObject



9
10
11
12
13
14
15
16
# File 'app/models/concerns/foreman_bootdisk/host_ext.rb', line 9

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

#bootdisk_template_renderObject



18
19
20
# File 'app/models/concerns/foreman_bootdisk/host_ext.rb', line 18

def bootdisk_template_render
  ForemanBootdisk::Renderer.new.render_template(template: bootdisk_template, host: self)
end

#can_be_built?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'app/models/concerns/foreman_bootdisk/host_ext.rb', line 38

def can_be_built?
  super || (managed? && bootdisk_build? && !build?)
end

#intel_arch?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/models/concerns/foreman_bootdisk/host_ext.rb', line 34

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