Class: ForemanBootdisk::Renderer

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_bootdisk/renderer.rb

Instance Method Summary collapse

Instance Method Details

#generic_efi_template_render(subnet) ⇒ Object

[View source]

23
24
25
26
27
28
29
# File 'app/services/foreman_bootdisk/renderer.rb', line 23

def generic_efi_template_render(subnet)
  if subnet.httpboot?
    render_template(template: generic_efi_host_template, host: stub_host(subnet), subnet: subnet)
  else
    ForemanBootdisk.logger.warn('HTTPBOOT feature is not enabled for subnet %s, UEFI may not be available for bootdisk' % subnet.name)
  end
end

#generic_template_render(subnet = nil) ⇒ Object

[View source]

19
20
21
# File 'app/services/foreman_bootdisk/renderer.rb', line 19

def generic_template_render(subnet = nil)
  render_template(template: generic_host_template, host: stub_host(subnet), subnet: subnet)
end

#render_template(template:, host:, scope_class: renderer_scope, subnet: nil) ⇒ Object

[View source]

7
8
9
10
11
12
13
14
15
16
17
# File 'app/services/foreman_bootdisk/renderer.rb', line 7

def render_template(template:, host:, scope_class: renderer_scope, subnet: nil)
  source = Foreman::Renderer.get_source(
    template: template,
  )
  scope = Foreman::Renderer.get_scope(
    host: host,
    variables: { subnet: subnet, bootdisk: true },
    klass: scope_class,
  )
  Foreman::Renderer.render(source, scope)
end