foreman_bootdisk 15.0.0 → 17.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yaml +19 -0
  3. data/.tx/config +1 -1
  4. data/AUTHORS +11 -0
  5. data/README.md +25 -0
  6. data/app/controllers/concerns/allowed_actions.rb +16 -0
  7. data/app/controllers/foreman_bootdisk/api/v2/disks_controller.rb +9 -7
  8. data/app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb +16 -4
  9. data/app/controllers/foreman_bootdisk/disks_controller.rb +14 -10
  10. data/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb +71 -45
  11. data/app/lib/foreman_bootdisk/scope/bootdisk.rb +28 -1
  12. data/app/lib/foreman_bootdisk/scope/full_host_bootdisk_efi.rb +15 -0
  13. data/app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb +10 -1
  14. data/app/models/concerns/foreman_bootdisk/host_ext.rb +13 -6
  15. data/app/models/concerns/foreman_bootdisk/orchestration/compute.rb +38 -22
  16. data/app/models/setting/bootdisk.rb +25 -19
  17. data/app/services/foreman_bootdisk/iso_generator.rb +132 -51
  18. data/app/services/foreman_bootdisk/renderer.rb +36 -19
  19. data/app/views/foreman_bootdisk/generic_efi_host.erb +68 -0
  20. data/app/views/foreman_bootdisk/generic_static_host.erb +34 -0
  21. data/app/views/foreman_bootdisk/host.erb +29 -8
  22. data/db/seeds.d/50-bootdisk_templates.rb +15 -31
  23. data/lib/foreman_bootdisk/engine.rb +9 -6
  24. data/lib/foreman_bootdisk/version.rb +1 -1
  25. data/lib/tasks/bootdisk.rake +10 -24
  26. data/locale/action_names.rb +7 -0
  27. data/locale/ca/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  28. data/locale/ca/foreman_bootdisk.po +58 -7
  29. data/locale/de/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  30. data/locale/de/foreman_bootdisk.po +62 -11
  31. data/locale/en/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  32. data/locale/en/foreman_bootdisk.po +56 -5
  33. data/locale/en_GB/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  34. data/locale/en_GB/foreman_bootdisk.po +62 -11
  35. data/locale/es/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  36. data/locale/es/foreman_bootdisk.po +62 -11
  37. data/locale/foreman_bootdisk.pot +108 -36
  38. data/locale/fr/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  39. data/locale/fr/foreman_bootdisk.po +61 -10
  40. data/locale/it/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  41. data/locale/it/foreman_bootdisk.po +60 -9
  42. data/locale/ja/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  43. data/locale/ja/foreman_bootdisk.po +61 -10
  44. data/locale/ko/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  45. data/locale/ko/foreman_bootdisk.po +60 -9
  46. data/locale/pt_BR/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  47. data/locale/pt_BR/foreman_bootdisk.po +60 -9
  48. data/locale/ru/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  49. data/locale/ru/foreman_bootdisk.po +60 -9
  50. data/locale/sv_SE/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  51. data/locale/sv_SE/foreman_bootdisk.po +59 -8
  52. data/locale/zh_CN/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  53. data/locale/zh_CN/foreman_bootdisk.po +60 -9
  54. data/locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  55. data/locale/zh_TW/foreman_bootdisk.po +60 -9
  56. data/release-gem +2 -0
  57. data/test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb +51 -17
  58. data/test/functional/foreman_bootdisk/api/v2/subnet_disks_controller_test.rb +23 -10
  59. data/test/functional/foreman_bootdisk/disks_controller_test.rb +65 -25
  60. data/test/test_plugin_helper.rb +21 -3
  61. data/test/unit/concerns/host_test.rb +12 -1
  62. data/test/unit/concerns/orchestration/compute_test.rb +32 -13
  63. data/test/unit/foreman_bootdisk/renderer_test.rb +1 -1
  64. data/test/unit/iso_generator_test.rb +6 -7
  65. metadata +14 -9
@@ -4,36 +4,46 @@ require 'uri'
4
4
 
5
5
  module ForemanBootdisk
6
6
  class Renderer
7
- def generic_template_render(subnet = nil)
8
- host = if subnet.present?
9
- # rendering a subnet-level bootdisk requires tricking the renderer into thinking it has a
10
- # valid host, without a token, but with a tftp proxy
11
- Struct.new(:token, :provision_interface, :content_source).new(
12
- nil,
13
- Struct.new(:subnet).new(subnet),
14
- nil
15
- )
16
- else
17
- Struct.new(:token, :subnet, :content_source).new(nil, nil, nil)
18
- end
19
-
20
- render_template(template: generic_host_template, host: host)
21
- end
22
-
23
- def render_template(template:, host:, scope_class: renderer_scope)
7
+ def render_template(template:, host:, scope_class: renderer_scope, subnet: nil)
24
8
  source = Foreman::Renderer.get_source(
25
9
  template: template,
26
- host: host
27
10
  )
28
11
  scope = Foreman::Renderer.get_scope(
29
12
  host: host,
30
- klass: scope_class
13
+ variables: { subnet: subnet, bootdisk: true },
14
+ klass: scope_class,
31
15
  )
32
16
  Foreman::Renderer.render(source, scope)
33
17
  end
34
18
 
19
+ def generic_template_render(subnet = nil)
20
+ render_template(template: generic_host_template, host: stub_host(subnet), subnet: subnet)
21
+ end
22
+
23
+ def generic_efi_template_render(subnet)
24
+ if subnet.httpboot?
25
+ render_template(template: generic_efi_host_template, host: stub_host(subnet), subnet: subnet)
26
+ else
27
+ ForemanBootdisk.logger.warn('HTTPBOOT feature is not enabled for subnet %s, UEFI may not be available for bootdisk' % subnet.name)
28
+ end
29
+ end
30
+
35
31
  private
36
32
 
33
+ def stub_host(subnet)
34
+ if subnet.present?
35
+ # rendering a subnet-level bootdisk requires tricking the renderer into thinking it has a
36
+ # valid host, without a token, but with a tftp proxy
37
+ Struct.new(:token, :provision_interface, :content_source).new(
38
+ nil,
39
+ Struct.new(:subnet).new(subnet),
40
+ nil
41
+ )
42
+ else
43
+ Struct.new(:token, :subnet, :content_source).new(nil, nil, nil)
44
+ end
45
+ end
46
+
37
47
  def renderer_scope
38
48
  ForemanBootdisk::Scope::Bootdisk
39
49
  end
@@ -44,5 +54,12 @@ module ForemanBootdisk
44
54
 
45
55
  template
46
56
  end
57
+
58
+ def generic_efi_host_template
59
+ template = ProvisioningTemplate.unscoped.find_by(name: Setting[:bootdisk_generic_efi_host_template])
60
+ raise ::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_generic_efi_host_template') unless template
61
+
62
+ template
63
+ end
47
64
  end
48
65
  end
@@ -0,0 +1,68 @@
1
+ #
2
+ # Boot disk Grub2 EFI - generic host
3
+ #
4
+ #set debug="http,efinet,net"
5
+ #set debug=all
6
+ echo "Foreman Bootdisk: 'Boot disk Grub2 EFI - generic host' template"
7
+ echo
8
+ echo "********************************************************"
9
+ echo " REQUIREMENTS:"
10
+ echo " * SUBNET GENERIC IMAGE ONLY (host image not supported)"
11
+ echo " * HOST PARAM default_grub_install_entry set to efi_http"
12
+ echo " * PROXY WITH HTTPBOOT FEATURE"
13
+ echo " * HTTP UEFI BOOT ONLY (Legacy/PXE not supported)"
14
+ echo " * IPv4 ONLY (IPv6 not tested, change the template)"
15
+ echo " * HTTP ONLY (change the template for HTTPS)"
16
+ echo " * ISC DHCP (other servers not tested)"
17
+ echo " * GRUB FROM RHEL 8.3+/7.9+ (when generating the image)"
18
+ echo " * EFI HTTP or HTTPS grub entry must be selected in menu"
19
+ echo " * DNS must resolve proxy hostname via DNS proxy if set"
20
+ echo "*******************************************************"
21
+ sleep 5
22
+ <%
23
+ # possible values are: "http" or "https"
24
+ proxy_proto = "http"
25
+
26
+ @subnet || bootdisk_raise("Generic disk not supported for EFI, use subnet disk")
27
+ @subnet.template? || bootdisk_raise("Requires a proxy with template feature")
28
+ proxy_port = if proxy_proto == "http"
29
+ @subnet.httpboot.httpboot_http_port
30
+ else
31
+ @subnet.httpboot.httpboot_https_port
32
+ end
33
+ # Workaround for "no DNS server configured" https://bugzilla.redhat.com/show_bug.cgi?id=1842509
34
+ proxy_httpboot_host = dns_lookup(@subnet.httpboot.hostname)
35
+ proxy_template_host = dns_lookup(@subnet.template.hostname)
36
+ -%>
37
+ echo
38
+ net_ls_cards
39
+ echo "Configuring ALL cards via BOOTP/IPv4"
40
+ net_bootp
41
+ # uncomment here for IPv6 support (not tested)
42
+ #echo "Configuring ALL cards via BOOTP/IPv6"
43
+ #net_ipv6_autoconf
44
+ net_ls_addr
45
+ net_ls_routes
46
+ net_ls_dns
47
+ echo Trying to ping proxy_httpboot_host: <%= proxy_httpboot_host %>
48
+ ping --count 1 <%= proxy_httpboot_host %> || echo Ping to proxy_httpboot_host failed or ping command not available.
49
+ echo Trying to ping proxy_template_host: <%= proxy_template_host %>
50
+ ping --count 1 <%= proxy_template_host %> || echo Ping to proxy_template_host failed or ping command not available.
51
+ sleep 5
52
+ set root=(<%= proxy_proto %>,<%= proxy_httpboot_host %>:<%= proxy_port %>)
53
+ # The variable will not survive configfile fetch, therefore absolute path
54
+ # must be used in the chainloaded template.
55
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1842893
56
+ set http_path=/httpboot/
57
+ set default=efi_<%= proxy_proto %>
58
+ <% (0..32).each do |i| -%>
59
+ echo "Trying efinet<%= i %> via <%= proxy_proto %>://<%= proxy_template_host %>:<%= proxy_port %>/unattended/PXEGrub2?mac=$net_efinet<%= i %>_dhcp_mac"
60
+ set net_default_mac=$net_efinet<%= i %>_dhcp_mac
61
+ sleep 5
62
+ configfile (<%= proxy_proto %>,<%= proxy_template_host %>:<%= proxy_port %>)/unattended/PXEGrub2?mac=$net_efinet<%= i %>_dhcp_mac
63
+ <% end -%>
64
+
65
+ echo "Could not find a host with PXEGrub2 template and one of the MAC addresses!"
66
+ echo "The system will poweroff in few minutes..."
67
+ sleep 500
68
+ poweroff
@@ -0,0 +1,34 @@
1
+ #!ipxe
2
+ #
3
+ # Generic host template with interactive static IP configuration. Tokens
4
+ # must be disabled in order to access templates via MAC addresses.
5
+ #
6
+
7
+ <% (0..32).each do |i| -%>
8
+ :net<%= i %>
9
+ isset ${net<%= i -%>/mac} || goto configure
10
+ echo Found ${net<%= i -%>/mac} as net<%= i -%> on a ${net<%= i -%>/chip}
11
+ goto net<%= i+1 %>
12
+ <% end -%>
13
+
14
+ :configure
15
+ echo -n Interface (e.g. net0): && read interface
16
+ iseq ${interface} n && goto reboot ||
17
+ iseq ${interface} N && goto reboot ||
18
+
19
+ ifopen ${interface}
20
+ echo Please enter IPv4 details for ${interface}
21
+ echo
22
+
23
+ echo -n IP address: && read ${interface}/ip
24
+ echo -n Subnet mask: && read ${interface}/netmask
25
+ echo -n Default gateway: && read ${interface}/gateway
26
+ echo -n DNS server: && read dns
27
+
28
+ chain <%= bootdisk_chain_url %>${${interface}/mac} || goto reboot
29
+ exit 0
30
+
31
+ :reboot
32
+ echo Unable to continue, rebooting...
33
+ sleep 30
34
+ exit 1
@@ -7,9 +7,23 @@
7
7
  <%
8
8
  interface = @host.provision_interface
9
9
  bootdisk_raise(N_('Host has no provisioning interface defined')) unless interface
10
- bootdisk_raise(N_('Host has no IP address defined')) if interface.ip.nil? || interface.ip.empty?
11
- bootdisk_raise(N_('Host has no subnet defined')) unless interface.subnet
10
+ bootdisk_raise(N_('Host has no IPv4 or IPv6 address defined')) unless interface.ip.present? || interface.ip6.present?
11
+ bootdisk_raise(N_('Host has no subnet defined')) unless interface.subnet || interface.subnet6
12
12
  bootdisk_raise(N_('Host has no domain defined')) unless interface.domain
13
+ if interface.ip.present? && interface.subnet
14
+ ip = interface.ip
15
+ subnet = interface.subnet
16
+ elsif interface.ip6.present? && interface.subnet6
17
+ ip = interface.ip6
18
+ subnet = interface.subnet6
19
+ bootdisk_raise(N_('Host bootdisk does not work with static IPv6'))
20
+ else
21
+ bootdisk_raise(N_('Both IP and Subnet must be set'))
22
+ end
23
+
24
+ mask = subnet.mask
25
+ gw = subnet.gateway
26
+ dns = subnet.dns_servers.first
13
27
  %>
14
28
 
15
29
  echo Foreman Bootdisk: Host image (<%= @host.name %>)
@@ -25,25 +39,32 @@ goto loop_success
25
39
  <% end -%>
26
40
 
27
41
  :loop_success
28
- echo Configuring net${idx} for static IP address <%= interface.ip %>
42
+ echo Configuring net${idx} for static IP address <%= ip %>
29
43
  ifopen net${idx}
30
- set netX/ip <%= interface.ip %>
31
- set netX/netmask <%= interface.subnet.mask %>
32
- <% if interface.subnet.gateway.present? %>
33
- set netX/gateway <%= interface.subnet.gateway %>
44
+ # netX = last opened NIC
45
+ set netX/ip <%= ip %>
46
+ set netX/netmask <%= mask %>
47
+ <% if gw.present? %>
48
+ set netX/gateway <%= gw %>
34
49
  <% end %>
35
50
  ifstat net${idx}
36
51
  route
37
52
 
38
53
  # Note: When multiple DNS servers are specified, only the first
39
54
  # server will be used. See: http://ipxe.org/cfg/dns
40
- <% dns = interface.subnet.dns_servers.first -%>
41
55
  <% if dns.present? -%>
42
56
  echo Using DNS <%= dns %>
43
57
  set dns <%= dns %>
44
58
  set domain <%= interface.domain.to_s %>
45
59
  <% end %>
46
60
 
61
+ echo Trying to ping Gateway: ${netX/gateway}
62
+ ping --count 1 ${netX/gateway} || echo Ping to Gateway failed or ping command not available.
63
+ <% if dns.present? -%>
64
+ echo Trying to ping DNS: ${netX/dns}
65
+ ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not available.
66
+ <% end %>
67
+
47
68
  # Chainload from Foreman rather than embedding OS info here, so the behaviour
48
69
  # is entirely dynamic.
49
70
  chain <%= bootdisk_chain_url %>
@@ -1,32 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- kind = TemplateKind.unscoped.where(name: 'Bootdisk').first_or_create
4
-
5
- organizations = Organization.all
6
- locations = Location.all
7
- created = []
8
-
9
- ProvisioningTemplate.without_auditing do
10
- content = File.read(File.join(ForemanBootdisk::Engine.root, 'app', 'views', 'foreman_bootdisk', 'host.erb'))
11
- created << 'Boot disk iPXE - host' unless ProvisioningTemplate.find_by(name: 'Boot disk iPXE - host')
12
- tmpl = ProvisioningTemplate.unscoped.where(name: 'Boot disk iPXE - host').first_or_create do |template|
13
- template.attributes = {
14
- template_kind_id: kind.id,
15
- snippet: false,
16
- template: content
17
- }
18
- end
19
- tmpl.attributes = {
20
- template: content,
21
- default: true,
22
- vendor: 'Foreman boot disk'
23
- }
24
- tmpl.locked = true
25
- tmpl.save!(validate: false) if tmpl.changes.present?
3
+ def read_bootdisk_template(filename)
4
+ File.read(File.join(ForemanBootdisk::Engine.root, 'app', 'views', 'foreman_bootdisk', filename))
5
+ end
26
6
 
27
- content = File.read(File.join(ForemanBootdisk::Engine.root, 'app', 'views', 'foreman_bootdisk', 'generic_host.erb'))
28
- created << 'Boot disk iPXE - generic host' unless ProvisioningTemplate.find_by(name: 'Boot disk iPXE - generic host')
29
- tmpl = ProvisioningTemplate.unscoped.where(name: 'Boot disk iPXE - generic host').first_or_create do |template|
7
+ def ensure_bootdisk_template(name, content)
8
+ kind = TemplateKind.unscoped.where(name: 'Bootdisk').first_or_create
9
+ tmpl = ProvisioningTemplate.unscoped.where(name: name).first_or_create do |template|
30
10
  template.attributes = {
31
11
  template_kind_id: kind.id,
32
12
  snippet: false,
@@ -36,13 +16,17 @@ ProvisioningTemplate.without_auditing do
36
16
  tmpl.attributes = {
37
17
  template: content,
38
18
  default: true,
39
- vendor: 'Foreman boot disk'
19
+ vendor: "Foreman boot disk"
40
20
  }
41
21
  tmpl.locked = true
22
+ tmpl.organizations = Organization.unscoped.all if SETTINGS[:organizations_enabled]
23
+ tmpl.locations = Location.unscoped.all if SETTINGS[:locations_enabled]
42
24
  tmpl.save!(validate: false) if tmpl.changes.present?
25
+ end
43
26
 
44
- ProvisioningTemplate.unscoped.where(name: created, default: true).each do |template|
45
- template.organizations = organizations if SETTINGS[:organizations_enabled]
46
- template.locations = locations if SETTINGS[:locations_enabled]
47
- end
27
+ ProvisioningTemplate.without_auditing do
28
+ ensure_bootdisk_template("Boot disk iPXE - host", read_bootdisk_template("host.erb"))
29
+ ensure_bootdisk_template("Boot disk iPXE - generic host", read_bootdisk_template("generic_host.erb"))
30
+ ensure_bootdisk_template("Boot disk Grub2 EFI - generic host", read_bootdisk_template("generic_efi_host.erb"))
31
+ ensure_bootdisk_template("Boot disk iPXE - generic static host", read_bootdisk_template("generic_static_host.erb"))
48
32
  end
@@ -38,7 +38,7 @@ module ForemanBootdisk
38
38
 
39
39
  initializer 'foreman_bootdisk.register_plugin', before: :finisher_hook do |_app|
40
40
  Foreman::Plugin.register :foreman_bootdisk do
41
- requires_foreman '>= 1.22'
41
+ requires_foreman '>= 2.1'
42
42
 
43
43
  security_block :bootdisk do |_map|
44
44
  permission :download_bootdisk, 'foreman_bootdisk/disks': %i[generic host full_host subnet help],
@@ -46,11 +46,14 @@ module ForemanBootdisk
46
46
  'foreman_bootdisk/api/v2/subnet_disks': [:subnet]
47
47
  end
48
48
 
49
- role 'Boot disk access', [:download_bootdisk]
49
+ role 'Boot disk access', [:download_bootdisk], 'Role granting permissions to download bootdisks'
50
50
 
51
51
  add_all_permissions_to_default_roles
52
52
 
53
53
  apipie_documented_controllers ["#{ForemanBootdisk::Engine.root}/app/controllers/foreman_bootdisk/api/v2/*.rb"]
54
+ ApipieDSL.configuration.dsl_classes_matchers += [
55
+ "#{ForemanBootdisk::Engine.root}/app/lib/foreman_bootdisk/scope/*.rb"
56
+ ]
54
57
  provision_method 'bootdisk', N_('Boot disk based')
55
58
  template_labels 'Bootdisk' => N_('Boot disk embedded template')
56
59
  allowed_template_helpers :bootdisk_chain_url, :bootdisk_raise
@@ -65,10 +68,10 @@ module ForemanBootdisk
65
68
 
66
69
  config.to_prepare do
67
70
  begin
68
- Host::Managed.send(:prepend, ForemanBootdisk::HostExt)
69
- Host::Managed.send(:include, ForemanBootdisk::Orchestration::Compute) if SETTINGS[:unattended]
70
- HostsHelper.send(:prepend, ForemanBootdisk::HostsHelperExt)
71
- Foreman::Model::Vmware.send(:prepend, ForemanBootdisk::ComputeResources::Vmware) if Foreman::Model::Vmware.available?
71
+ Host::Managed.prepend ForemanBootdisk::HostExt
72
+ Host::Managed.include ForemanBootdisk::Orchestration::Compute if SETTINGS[:unattended]
73
+ HostsHelper.prepend ForemanBootdisk::HostsHelperExt
74
+ Foreman::Model::Vmware.prepend ForemanBootdisk::ComputeResources::Vmware if Foreman::Model::Vmware.available?
72
75
  rescue StandardError => e
73
76
  Rails.logger.warn "#{ForemanBootdisk::ENGINE_NAME}: skipping engine hook (#{e})"
74
77
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanBootdisk
4
- VERSION = '15.0.0'
4
+ VERSION = '17.1.0'
5
5
  end
@@ -20,9 +20,10 @@ namespace :bootdisk do
20
20
  task host: :environment do
21
21
  User.as_anonymous_admin do
22
22
  host = Host::Base.unscoped.find_by(name: ENV['NAME']) || raise("cannot find host '#{ENV['NAME']}', specify NAME=fqdn")
23
- tmpl = host.bootdisk_template_render
23
+ tmpl_bios = host.bootdisk_template_render
24
+ tmpl_efi = host.generic_efi_template_render
24
25
 
25
- ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl, dir: outputdir) do |image|
26
+ ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl_bios, grub: tmpl_efi, dir: outputdir) do |image|
26
27
  output = ENV['OUTPUT'] || File.join(outputdir, "#{host.name}.iso")
27
28
  FileUtils.mv image, output
28
29
  puts "Wrote #{output}"
@@ -45,9 +46,9 @@ namespace :bootdisk do
45
46
  desc 'Generate a generic boot disk. OUTPUT=path'
46
47
  task generic: :environment do
47
48
  User.as_anonymous_admin do
48
- tmpl = ForemanBootdisk::Renderer.new.generic_template_render
49
+ tmpl_bios = ForemanBootdisk::Renderer.new.generic_template_render
49
50
 
50
- ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl, dir: outputdir) do |image|
51
+ ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl_bios, dir: outputdir) do |image|
51
52
  output = ENV['OUTPUT'] || File.join(outputdir, "bootdisk_#{URI.parse(Setting[:foreman_url]).host}.iso")
52
53
  FileUtils.cp image, output
53
54
  puts "Wrote #{output}"
@@ -60,8 +61,10 @@ namespace :bootdisk do
60
61
  User.as_anonymous_admin do
61
62
  subnet = Subnet.unscoped.find_by(name: ENV['NAME']) || raise("cannot find subnet '#{ENV['NAME']}', specify NAME=subnet")
62
63
  subnet.tftp || raise(::Foreman::Exception.new(N_('TFTP feature not enabled for subnet %s'), subnet.name))
63
- tmpl = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
64
- ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl, dir: outputdir) do |image|
64
+ subnet.httpboot || ForemanBootdisk.logger.warn('HTTPBOOT feature is not enabled for subnet %s, UEFI may not be available for bootdisk' % subnet.name)
65
+ tmpl_bios = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
66
+ tmpl_efi = ForemanBootdisk::Renderer.new.generic_efi_template_render(subnet)
67
+ ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl_bios, grub: tmpl_efi, dir: outputdir) do |image|
65
68
  output = ENV['OUTPUT'] || File.join(outputdir, "bootdisk_subnet_#{subnet.name}.iso")
66
69
  FileUtils.cp image, output
67
70
  puts "Wrote #{output}"
@@ -85,22 +88,5 @@ end
85
88
 
86
89
  Rake::Task[:test].enhance ['test:foreman_bootdisk']
87
90
 
88
- namespace :foreman_bootdisk do
89
- task :rubocop do
90
- begin
91
- require 'rubocop/rake_task'
92
- RuboCop::RakeTask.new(:rubocop_foreman_bootdisk) do |task|
93
- task.patterns = ["#{ForemanBootdisk::Engine.root}/app/**/*.rb",
94
- "#{ForemanBootdisk::Engine.root}/lib/**/*.rb",
95
- "#{ForemanBootdisk::Engine.root}/test/**/*.rb"]
96
- end
97
- rescue StandardError
98
- puts 'Rubocop not loaded.'
99
- end
100
-
101
- Rake::Task['rubocop_foreman_bootdisk'].invoke
102
- end
103
- end
104
-
105
91
  load 'tasks/jenkins.rake'
106
- Rake::Task['jenkins:unit'].enhance ['test:foreman_bootdisk', 'foreman_bootdisk:rubocop'] if Rake::Task.task_defined?(:'jenkins:unit')
92
+ Rake::Task['jenkins:unit'].enhance ['test:foreman_bootdisk'] if Rake::Task.task_defined?(:'jenkins:unit')
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Autogenerated!
4
+ _("Remote action:")
5
+ _("Import facts")
6
+ _("Import Puppet classes")
7
+ _("Action with sub plans")
@@ -7,9 +7,9 @@
7
7
  # Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>, 2015-2016
8
8
  msgid ""
9
9
  msgstr ""
10
- "Project-Id-Version: foreman_bootdisk 14.0.0\n"
10
+ "Project-Id-Version: foreman_bootdisk 17.0.0\n"
11
11
  "Report-Msgid-Bugs-To: \n"
12
- "PO-Revision-Date: 2019-04-18 20:22+0000\n"
12
+ "PO-Revision-Date: 2019-10-22 20:06+0000\n"
13
13
  "Last-Translator: Lukáš Zapletal\n"
14
14
  "Language-Team: Catalan (http://www.transifex.com/foreman/foreman/language/ca/)"
15
15
  "\n"
@@ -22,6 +22,9 @@ msgstr ""
22
22
  msgid "A variant of the per-host image which contains the OS bootloader embedded inside the disk. This may be useful if chainloading fails on certain hardware, but has the downside that the image must be regenerated for any change in the OS, bootloader or PXELinux templates."
23
23
  msgstr ""
24
24
 
25
+ msgid "Action with sub plans"
26
+ msgstr ""
27
+
25
28
  msgid "All images are usable as either ISOs or as disk images, including being written to a USB disk with `dd`."
26
29
  msgstr ""
27
30
 
@@ -46,9 +49,18 @@ msgstr ""
46
49
  msgid "Boot disks"
47
50
  msgstr "Discs d'arrencada"
48
51
 
52
+ msgid "Both IP and Subnet must be set"
53
+ msgstr ""
54
+
49
55
  msgid "Command to generate ISO image, use genisoimage or mkisofs"
50
56
  msgstr "L'ordre per generar la imatge ISO, utilitzeu genisoimage o mkisofs"
51
57
 
58
+ msgid "Creating new image failed, install truncate utility"
59
+ msgstr ""
60
+
61
+ msgid "Detach ISO image from CDROM drive for %s"
62
+ msgstr ""
63
+
52
64
  msgid "Download generic image"
53
65
  msgstr "Baixa la imatge genèrica"
54
66
 
@@ -58,9 +70,21 @@ msgstr "Baixa la imatge d'amfitrió"
58
70
  msgid "Download subnet generic image"
59
71
  msgstr "Baixa la imatge genèrica de subxarxa"
60
72
 
73
+ msgid "Ensure %{path} contains grubx64.efi and shimx64.efi: install TFTP module or copy those files into /var/lib/foreman/bootdisk (Grub2 directory setting)"
74
+ msgstr ""
75
+
61
76
  msgid "Failed to attach ISO image to CDROM drive of instance %{name}: %{message}"
62
77
  msgstr ""
63
78
 
79
+ msgid "Failed to create a directory within the ESP image"
80
+ msgstr ""
81
+
82
+ msgid "Failed to detach ISO image from CDROM drive of instance %{name}: %{message}"
83
+ msgstr ""
84
+
85
+ msgid "Failed to format the ESP image via mkfs.msdos"
86
+ msgstr ""
87
+
64
88
  msgid "Failed to generate ISO image for instance %{name}: %{message}"
65
89
  msgstr ""
66
90
 
@@ -79,6 +103,9 @@ msgstr "Imatge completa d'amfitrió"
79
103
  msgid "Generating ISO image for %s"
80
104
  msgstr ""
81
105
 
106
+ msgid "Generic Grub2 EFI image template"
107
+ msgstr ""
108
+
82
109
  msgid "Generic image"
83
110
  msgstr "Imatge genèrica"
84
111
 
@@ -88,14 +115,23 @@ msgstr ""
88
115
  msgid "Generic images are a reusable disk image that works for any host registered in Foreman. It requires a basic DHCP and DNS service to function and contact the server, but does not require DHCP reservations or static IP addresses."
89
116
  msgstr ""
90
117
 
118
+ msgid "Grub2 directory"
119
+ msgstr ""
120
+
121
+ msgid "Grub2 template to use for generic EFI host boot disks"
122
+ msgstr ""
123
+
91
124
  msgid "Help"
92
125
  msgstr "Ajuda"
93
126
 
94
127
  msgid "Host '%s' image"
95
128
  msgstr ""
96
129
 
97
- msgid "Host has no IP address defined"
98
- msgstr "L'amfitrió no té definida cap adreça IP"
130
+ msgid "Host bootdisk does not work with static IPv6"
131
+ msgstr ""
132
+
133
+ msgid "Host has no IPv4 or IPv6 address defined"
134
+ msgstr ""
99
135
 
100
136
  msgid "Host has no domain defined"
101
137
  msgstr "L'amfitrió no té definit cap domini"
@@ -121,12 +157,18 @@ msgstr "No s'ha pogut construir l'ISO"
121
157
  msgid "ISO generation command"
122
158
  msgstr ""
123
159
 
124
- msgid "ISO hybrid conversion failed"
160
+ msgid "ISO hybrid conversion failed: %s"
125
161
  msgstr ""
126
162
 
127
163
  msgid "ISOLINUX directory"
128
164
  msgstr ""
129
165
 
166
+ msgid "Import Puppet classes"
167
+ msgstr ""
168
+
169
+ msgid "Import facts"
170
+ msgstr ""
171
+
130
172
  msgid "Installation media caching"
131
173
  msgstr ""
132
174
 
@@ -136,6 +178,9 @@ msgstr "Els fitxers dels mitjans d'instal·lació s'emmagatzemaran en memòria c
136
178
  msgid "Once chainloaded, the OS bootloader and installer are downloaded directly from the installation media configured in Foreman, and the provisioning script (kickstart/preseed) is downloaded from Foreman."
137
179
  msgstr ""
138
180
 
181
+ msgid "Path to directory containing grubx64.efi and shimx64.efi"
182
+ msgstr ""
183
+
139
184
  msgid "Path to directory containing iPXE images"
140
185
  msgstr "El camí al directori que conté les imatges iPXE"
141
186
 
@@ -157,6 +202,9 @@ msgstr ""
157
202
  msgid "Plugin for Foreman that creates iPXE-based boot disks to provision hosts without the need for PXE infrastructure."
158
203
  msgstr ""
159
204
 
205
+ msgid "Remote action:"
206
+ msgstr ""
207
+
160
208
  msgid "SYSLINUX directory"
161
209
  msgstr ""
162
210
 
@@ -190,10 +238,13 @@ msgstr ""
190
238
  msgid "Unable to find template specified by %s setting"
191
239
  msgstr "No es pot trobar la plantilla especificada per l'ajust %s"
192
240
 
193
- msgid "Unable to generate disk PXELinux template: %s"
241
+ msgid "Unable to generate disk %{kind} template: %{error}"
242
+ msgstr ""
243
+
244
+ msgid "Unable to generate disk template, %{kind} template not found."
194
245
  msgstr ""
195
246
 
196
- msgid "Unable to generate disk template, PXELinux template not found."
247
+ msgid "Unable to mcopy %{path}"
197
248
  msgstr ""
198
249
 
199
250
  msgid "Upload ISO image to datastore for %s"