foreman_bootdisk 19.0.9 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_bootdisk/api/v2/disks_controller.rb +0 -4
  3. data/app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb +0 -4
  4. data/app/controllers/foreman_bootdisk/disks_controller.rb +5 -3
  5. data/app/services/foreman_bootdisk/iso_generator.rb +1 -1
  6. data/config/routes/mount_engine.rb +1 -1
  7. data/lib/foreman_bootdisk/engine.rb +9 -5
  8. data/lib/foreman_bootdisk/version.rb +1 -1
  9. data/package.json +5 -6
  10. data/webpack/src/extensions/host/HostBootdiskButtons.js +22 -1
  11. metadata +3 -42
  12. data/app/views/foreman_bootdisk/generic_efi_host.erb +0 -76
  13. data/app/views/foreman_bootdisk/generic_host.erb +0 -51
  14. data/app/views/foreman_bootdisk/generic_static_host.erb +0 -39
  15. data/app/views/foreman_bootdisk/host.erb +0 -80
  16. data/db/migrate/20221102105354_fix_bootdisk_settings_category_to_dsl.rb +0 -7
  17. data/db/seeds.d/50-bootdisk_templates.rb +0 -36
  18. data/lib/foreman_bootdisk/engine.rb.orig +0 -162
  19. data/locale/ca/foreman_bootdisk.edit.po +0 -416
  20. data/locale/ca/foreman_bootdisk.po.time_stamp +0 -0
  21. data/locale/cs_CZ/foreman_bootdisk.edit.po +0 -362
  22. data/locale/cs_CZ/foreman_bootdisk.po.time_stamp +0 -0
  23. data/locale/de/foreman_bootdisk.edit.po +0 -422
  24. data/locale/de/foreman_bootdisk.po.time_stamp +0 -0
  25. data/locale/en/foreman_bootdisk.edit.po +0 -360
  26. data/locale/en/foreman_bootdisk.po.time_stamp +0 -0
  27. data/locale/en_GB/foreman_bootdisk.edit.po +0 -417
  28. data/locale/en_GB/foreman_bootdisk.po.time_stamp +0 -0
  29. data/locale/es/foreman_bootdisk.edit.po +0 -417
  30. data/locale/es/foreman_bootdisk.po.time_stamp +0 -0
  31. data/locale/fr/foreman_bootdisk.edit.po +0 -418
  32. data/locale/fr/foreman_bootdisk.po.time_stamp +0 -0
  33. data/locale/it/foreman_bootdisk.edit.po +0 -414
  34. data/locale/it/foreman_bootdisk.po.time_stamp +0 -0
  35. data/locale/ja/foreman_bootdisk.edit.po +0 -416
  36. data/locale/ja/foreman_bootdisk.po.time_stamp +0 -0
  37. data/locale/ka/foreman_bootdisk.edit.po +0 -414
  38. data/locale/ka/foreman_bootdisk.po.time_stamp +0 -0
  39. data/locale/ko/foreman_bootdisk.edit.po +0 -414
  40. data/locale/ko/foreman_bootdisk.po.time_stamp +0 -0
  41. data/locale/pt_BR/foreman_bootdisk.edit.po +0 -417
  42. data/locale/pt_BR/foreman_bootdisk.po.time_stamp +0 -0
  43. data/locale/ru/foreman_bootdisk.edit.po +0 -416
  44. data/locale/ru/foreman_bootdisk.po.time_stamp +0 -0
  45. data/locale/sv_SE/foreman_bootdisk.edit.po +0 -415
  46. data/locale/sv_SE/foreman_bootdisk.po.time_stamp +0 -0
  47. data/locale/zh_CN/foreman_bootdisk.edit.po +0 -414
  48. data/locale/zh_CN/foreman_bootdisk.po.time_stamp +0 -0
  49. data/locale/zh_TW/foreman_bootdisk.edit.po +0 -414
  50. data/locale/zh_TW/foreman_bootdisk.po.time_stamp +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e12008c500906ecab32278c6f77093100d95c102b31970075577f4f848d16a6f
4
- data.tar.gz: 852edb71c5fdb177c83e0660e4f769f238972b75aa5121938e7aadc992213e96
3
+ metadata.gz: 637d590cf13dbcf6512da5bd13ccb380304c0affff50e1528581bf61ca0603e6
4
+ data.tar.gz: 315c48d5f916315f6893bb3c69d4dae17567d4b8c7a073eb887ffbe80ecedeb4
5
5
  SHA512:
6
- metadata.gz: 4c9aade4e180839575afe1c3f8b1385c5bbcf1a72391cffaf98ea460efc6f01b85d3d1e7f800fece3319aecdea63e9dc1e9f959cf80c225fc5743e1532ad7501
7
- data.tar.gz: e97f237c2d6b547ce8a6eb39208bbb2dc97aedd514c4445f4ed9111b8f51b4757b601767a71e80088cb94bcf40f256e5447c7869e23eb92781c10e88b3607771
6
+ metadata.gz: 79b5f0a3d831e29ef08539710a39f5557d11122a44b2ebfbc0fbc0c9c9a9b9753816affdaf7450e82780aaa03c60eda8daae47e4d79cf183442566d67a68705e
7
+ data.tar.gz: c8a27d561bcfe068088b895468cbca4b8834946d27d74bf6bc873a9213ae8deab625a5eb4975e50e3c49c3ed5d081080e8f0311e8977f9ed46ce1eaff76e6f8f
@@ -9,10 +9,6 @@ module ForemanBootdisk
9
9
  include ::Api::Version2
10
10
  include AllowedActions
11
11
 
12
- resource_description do
13
- api_base_url '/bootdisk/api'
14
- end
15
-
16
12
  before_action :bootdisk_type_allowed?, only: :generic
17
13
  before_action :find_resource, only: :host
18
14
  skip_after_action :log_response_body
@@ -9,10 +9,6 @@ module ForemanBootdisk
9
9
  include ::Api::Version2
10
10
  include AllowedActions
11
11
 
12
- resource_description do
13
- api_base_url '/bootdisk/api'
14
- end
15
-
16
12
  rescue_from ActiveRecord::RecordNotFound, :with => :subnet_not_found
17
13
  before_action :bootdisk_type_allowed?, only: :subnet
18
14
  before_action :find_resource, only: :subnet
@@ -121,16 +121,18 @@ module ForemanBootdisk
121
121
  disable_full_host = action == 'full_host' && !host.build?
122
122
  actions << {
123
123
  title: title,
124
- link: "/bootdisk/disks/#{action}s/#{host.id}",
124
+ link: "/disks/#{action}s/#{host.id}",
125
125
  disabled: disable_full_host ? true : false,
126
- description: disable_full_host ? _('Host is not in build mode') : nil
126
+ description: disable_full_host ? _('Host is not in build mode') : nil,
127
+ icon: action,
127
128
  }
128
129
  end
129
130
  return allowed unless User.current.allowed_to?({controller: 'foreman_bootdisk/disks', action: 'help'})
130
131
 
131
132
  allowed.push({
132
133
  title: _('Boot disk help'),
133
- link: '/bootdisk/disks/help'
134
+ link: '/disks/help',
135
+ icon: 'help'
134
136
  })
135
137
  end
136
138
  end
@@ -217,7 +217,7 @@ module ForemanBootdisk
217
217
  else
218
218
  http_object = Net::HTTP
219
219
  end
220
- http_object.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
220
+ http_object.start(uri.host, uri.port) do |http|
221
221
  request = Net::HTTP::Get.new(uri.request_uri, 'Accept-Encoding' => 'plain')
222
222
 
223
223
  http.request(request) do |response|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Foreman::Application.routes.draw do
4
- mount ForemanBootdisk::Engine, at: '/bootdisk'
4
+ mount ForemanBootdisk::Engine, at: '/'
5
5
  end
@@ -6,6 +6,7 @@ require 'gettext_i18n_rails'
6
6
 
7
7
  module ForemanBootdisk
8
8
  class Engine < ::Rails::Engine
9
+ engine_name 'foreman_bootdisk'
9
10
  isolate_namespace ForemanBootdisk
10
11
 
11
12
  config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
@@ -29,7 +30,7 @@ module ForemanBootdisk
29
30
 
30
31
  initializer 'foreman_bootdisk.register_plugin', before: :finisher_hook do |_app|
31
32
  Foreman::Plugin.register :foreman_bootdisk do
32
- requires_foreman '>= 3.3'
33
+ requires_foreman '>= 3.4'
33
34
  # Add Global files for extending foreman-core components and routes
34
35
  register_global_js_file 'global'
35
36
 
@@ -48,7 +49,6 @@ module ForemanBootdisk
48
49
  "#{ForemanBootdisk::Engine.root}/app/lib/foreman_bootdisk/scope/*.rb"
49
50
  ]
50
51
  provision_method 'bootdisk', N_('Boot disk based')
51
- template_labels 'Bootdisk' => N_('Boot disk embedded template')
52
52
  allowed_template_helpers :bootdisk_chain_url, :bootdisk_raise
53
53
 
54
54
  extend_page "subnets/index" do |cx|
@@ -124,7 +124,7 @@ module ForemanBootdisk
124
124
  description: N_("Installation media files will be cached for full host images")
125
125
 
126
126
  setting "bootdisk_allowed_types",
127
- type: :array,
127
+ type: :string,
128
128
  default: Setting::Bootdisk.bootdisk_types,
129
129
  full_name: N_("Allowed bootdisk types"),
130
130
  description: N_("List of allowed bootdisk types, remove type to disable it")
@@ -139,12 +139,16 @@ module ForemanBootdisk
139
139
  Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
140
140
  end
141
141
 
142
+ # Temporary workaround fix for helpers
143
+ initializer 'foreman_bootdisk.rails_loading_workaround' do
144
+ HostsHelper.prepend ForemanBootdisk::HostsHelperExt
145
+ SubnetsHelper.prepend ForemanBootdisk::SubnetsHelperExt
146
+ end
147
+
142
148
  config.to_prepare do
143
149
  begin
144
150
  Host::Managed.prepend ForemanBootdisk::HostExt
145
151
  Host::Managed.include ForemanBootdisk::Orchestration::Compute
146
- HostsHelper.prepend ForemanBootdisk::HostsHelperExt
147
- SubnetsHelper.prepend ForemanBootdisk::SubnetsHelperExt
148
152
  Foreman::Model::Vmware.prepend ForemanBootdisk::ComputeResources::Vmware if Foreman::Model::Vmware.available?
149
153
  rescue StandardError => e
150
154
  Rails.logger.warn "#{ForemanBootdisk::ENGINE_NAME}: skipping engine hook (#{e})"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanBootdisk
4
- VERSION = '19.0.9'
4
+ VERSION = '21.0.0'
5
5
  end
data/package.json CHANGED
@@ -26,12 +26,11 @@
26
26
  "devDependencies": {
27
27
  "@babel/core": "^7.7.0",
28
28
  "@sheerun/mutationobserver-shim": "^0.3.3",
29
- "@theforeman/builder": "^8.15.0",
30
- "@theforeman/eslint-plugin-foreman": "8.15.0",
31
- "@theforeman/find-foreman": "^8.15.0",
32
- "@theforeman/stories": "^8.15.0",
33
- "@theforeman/test": "^8.15.0",
34
- "@theforeman/vendor-dev": "^8.15.0",
29
+ "@theforeman/builder": ">= 8.15.0",
30
+ "@theforeman/eslint-plugin-foreman": ">= 8.15.0",
31
+ "@theforeman/find-foreman": ">= 8.15.0",
32
+ "@theforeman/stories": ">= 8.15.0",
33
+ "@theforeman/test": ">= 8.15.0",
35
34
  "babel-eslint": "^10.0.3",
36
35
  "eslint": "^6.7.2",
37
36
  "prettier": "^1.19.1",
@@ -2,6 +2,12 @@ import React, { useEffect } from 'react';
2
2
  import { useSelector, useDispatch } from 'react-redux';
3
3
 
4
4
  import { DropdownItem, DropdownGroup } from '@patternfly/react-core';
5
+ import {
6
+ BanIcon,
7
+ BuildIcon,
8
+ BuilderImageIcon,
9
+ OutlinedQuestionCircleIcon,
10
+ } from '@patternfly/react-icons';
5
11
 
6
12
  import { get } from 'foremanReact/redux/API';
7
13
  import { foremanUrl } from 'foremanReact/common/helpers';
@@ -23,11 +29,24 @@ const HostBootdiskButtons = () => {
23
29
  const isLoading = useSelector(selectIsLoading);
24
30
  const options = useSelector(selectBootdiskOptions);
25
31
 
32
+ const iconComponent = icon => {
33
+ switch (icon) {
34
+ case 'host':
35
+ return <BuildIcon />;
36
+ case 'full_host':
37
+ return <BuilderImageIcon />;
38
+ case 'help':
39
+ return <OutlinedQuestionCircleIcon />;
40
+ default:
41
+ return null;
42
+ }
43
+ };
44
+
26
45
  useEffect(() => {
27
46
  dispatch(
28
47
  get({
29
48
  key: HOST_BOOTDISK_BUTTONS_REQUEST_KEY,
30
- url: foremanUrl(`/bootdisk/disks/bootdisk_options/${hostId}`),
49
+ url: foremanUrl(`/disks/bootdisk_options/${hostId}`),
31
50
  })
32
51
  );
33
52
  }, [dispatch, hostId]);
@@ -40,6 +59,7 @@ const HostBootdiskButtons = () => {
40
59
  href={foremanUrl(action.link)}
41
60
  isDisabled={action.disabled}
42
61
  description={action.description}
62
+ icon={iconComponent(action.icon)}
43
63
  >
44
64
  {action.title}
45
65
  </DropdownItem>
@@ -55,6 +75,7 @@ const HostBootdiskButtons = () => {
55
75
  options.architectureName
56
76
  )}
57
77
  tooltipProps={{ entryDelay: 0, exitDelay: 0 }}
78
+ icon={<BanIcon />}
58
79
  >
59
80
  {__('Not available')}
60
81
  </DropdownItem>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_bootdisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 19.0.9
4
+ version: 21.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Cleal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-29 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: theforeman-rubocop
@@ -72,10 +72,6 @@ files:
72
72
  - app/services/foreman_bootdisk/iso_generator.rb
73
73
  - app/services/foreman_bootdisk/renderer.rb
74
74
  - app/views/foreman_bootdisk/disks/help.html.erb
75
- - app/views/foreman_bootdisk/generic_efi_host.erb
76
- - app/views/foreman_bootdisk/generic_host.erb
77
- - app/views/foreman_bootdisk/generic_static_host.erb
78
- - app/views/foreman_bootdisk/host.erb
79
75
  - app/views/hosts/provision_method/bootdisk/_form.html.erb
80
76
  - app/views/subnets/_bootdisk_action_buttons.erb
81
77
  - app/views/subnets/_bootdisk_title_buttons.erb
@@ -88,78 +84,43 @@ files:
88
84
  - db/migrate/20131021095100_edit_host_bootdisk_template_dns_secondary.rb
89
85
  - db/migrate/20140522185700_change_templatekind_to_bootdisk.rb
90
86
  - db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
91
- - db/migrate/20221102105354_fix_bootdisk_settings_category_to_dsl.rb
92
- - db/seeds.d/50-bootdisk_templates.rb
93
87
  - lib/foreman_bootdisk.rb
94
88
  - lib/foreman_bootdisk/engine.rb
95
- - lib/foreman_bootdisk/engine.rb.orig
96
89
  - lib/foreman_bootdisk/version.rb
97
90
  - lib/tasks/bootdisk.rake
98
91
  - locale/Makefile
99
92
  - locale/action_names.rb
100
93
  - locale/ca/LC_MESSAGES/foreman_bootdisk.mo
101
- - locale/ca/foreman_bootdisk.edit.po
102
94
  - locale/ca/foreman_bootdisk.po
103
- - locale/ca/foreman_bootdisk.po.time_stamp
104
- - locale/cs_CZ/foreman_bootdisk.edit.po
105
- - locale/cs_CZ/foreman_bootdisk.po.time_stamp
106
95
  - locale/de/LC_MESSAGES/foreman_bootdisk.mo
107
- - locale/de/foreman_bootdisk.edit.po
108
96
  - locale/de/foreman_bootdisk.po
109
- - locale/de/foreman_bootdisk.po.time_stamp
110
97
  - locale/en/LC_MESSAGES/foreman_bootdisk.mo
111
- - locale/en/foreman_bootdisk.edit.po
112
98
  - locale/en/foreman_bootdisk.po
113
- - locale/en/foreman_bootdisk.po.time_stamp
114
99
  - locale/en_GB/LC_MESSAGES/foreman_bootdisk.mo
115
- - locale/en_GB/foreman_bootdisk.edit.po
116
100
  - locale/en_GB/foreman_bootdisk.po
117
- - locale/en_GB/foreman_bootdisk.po.time_stamp
118
101
  - locale/es/LC_MESSAGES/foreman_bootdisk.mo
119
- - locale/es/foreman_bootdisk.edit.po
120
102
  - locale/es/foreman_bootdisk.po
121
- - locale/es/foreman_bootdisk.po.time_stamp
122
103
  - locale/foreman_bootdisk.pot
123
104
  - locale/fr/LC_MESSAGES/foreman_bootdisk.mo
124
- - locale/fr/foreman_bootdisk.edit.po
125
105
  - locale/fr/foreman_bootdisk.po
126
- - locale/fr/foreman_bootdisk.po.time_stamp
127
106
  - locale/gemspec.rb
128
107
  - locale/it/LC_MESSAGES/foreman_bootdisk.mo
129
- - locale/it/foreman_bootdisk.edit.po
130
108
  - locale/it/foreman_bootdisk.po
131
- - locale/it/foreman_bootdisk.po.time_stamp
132
109
  - locale/ja/LC_MESSAGES/foreman_bootdisk.mo
133
- - locale/ja/foreman_bootdisk.edit.po
134
110
  - locale/ja/foreman_bootdisk.po
135
- - locale/ja/foreman_bootdisk.po.time_stamp
136
- - locale/ka/foreman_bootdisk.edit.po
137
- - locale/ka/foreman_bootdisk.po.time_stamp
138
111
  - locale/ko/LC_MESSAGES/foreman_bootdisk.mo
139
- - locale/ko/foreman_bootdisk.edit.po
140
112
  - locale/ko/foreman_bootdisk.po
141
- - locale/ko/foreman_bootdisk.po.time_stamp
142
113
  - locale/pt_BR/LC_MESSAGES/foreman_bootdisk.mo
143
- - locale/pt_BR/foreman_bootdisk.edit.po
144
114
  - locale/pt_BR/foreman_bootdisk.po
145
- - locale/pt_BR/foreman_bootdisk.po.time_stamp
146
115
  - locale/ru/LC_MESSAGES/foreman_bootdisk.mo
147
- - locale/ru/foreman_bootdisk.edit.po
148
116
  - locale/ru/foreman_bootdisk.po
149
- - locale/ru/foreman_bootdisk.po.time_stamp
150
117
  - locale/sv_SE/LC_MESSAGES/foreman_bootdisk.mo
151
- - locale/sv_SE/foreman_bootdisk.edit.po
152
118
  - locale/sv_SE/foreman_bootdisk.po
153
- - locale/sv_SE/foreman_bootdisk.po.time_stamp
154
119
  - locale/zanata.xml
155
120
  - locale/zh_CN/LC_MESSAGES/foreman_bootdisk.mo
156
- - locale/zh_CN/foreman_bootdisk.edit.po
157
121
  - locale/zh_CN/foreman_bootdisk.po
158
- - locale/zh_CN/foreman_bootdisk.po.time_stamp
159
122
  - locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo
160
- - locale/zh_TW/foreman_bootdisk.edit.po
161
123
  - locale/zh_TW/foreman_bootdisk.po
162
- - locale/zh_TW/foreman_bootdisk.po.time_stamp
163
124
  - package.json
164
125
  - webpack/__mocks__/foremanReact/common/HOC.js
165
126
  - webpack/__mocks__/foremanReact/common/I18n.js
@@ -195,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
156
  - !ruby/object:Gem::Version
196
157
  version: '0'
197
158
  requirements: []
198
- rubygems_version: 3.3.26
159
+ rubygems_version: 3.1.6
199
160
  signing_key:
200
161
  specification_version: 4
201
162
  summary: Create boot disks to provision hosts with Foreman
@@ -1,76 +0,0 @@
1
- <%#
2
- name: Boot disk Grub2 EFI - generic host
3
- snippet: false
4
- model: ProvisioningTemplate
5
- kind: Bootdisk
6
- description: |
7
- Boot disk Grub2 EFI - generic host
8
- -%>
9
- #
10
- # Boot disk Grub2 EFI - generic host
11
- #
12
- #set debug="http,efinet,net"
13
- #set debug=all
14
- echo "Foreman Bootdisk: 'Boot disk Grub2 EFI - generic host' template"
15
- echo
16
- echo "********************************************************"
17
- echo " REQUIREMENTS:"
18
- echo " * SUBNET GENERIC IMAGE ONLY (host image not supported)"
19
- echo " * HOST PARAM default_grub_install_entry set to efi_http"
20
- echo " * PROXY WITH HTTPBOOT FEATURE"
21
- echo " * HTTP UEFI BOOT ONLY (Legacy/PXE not supported)"
22
- echo " * IPv4 ONLY (IPv6 not tested, change the template)"
23
- echo " * HTTP ONLY (change the template for HTTPS)"
24
- echo " * ISC DHCP (other servers not tested)"
25
- echo " * GRUB FROM RHEL 8.3+/7.9+ (when generating the image)"
26
- echo " * EFI HTTP or HTTPS grub entry must be selected in menu"
27
- echo " * DNS must resolve proxy hostname via DNS proxy if set"
28
- echo "*******************************************************"
29
- sleep 5
30
- <%
31
- # possible values are: "http" or "https"
32
- proxy_proto = "http"
33
-
34
- @subnet || bootdisk_raise("Generic disk not supported for EFI, use subnet disk")
35
- @subnet.template? || bootdisk_raise("Requires a proxy with template feature")
36
- proxy_port = if proxy_proto == "http"
37
- @subnet.httpboot.httpboot_http_port
38
- else
39
- @subnet.httpboot.httpboot_https_port
40
- end
41
- # Workaround for "no DNS server configured" https://bugzilla.redhat.com/show_bug.cgi?id=1842509
42
- proxy_httpboot_host = dns_lookup(@subnet.httpboot.hostname)
43
- proxy_template_host = dns_lookup(@subnet.template.hostname)
44
- -%>
45
- echo
46
- net_ls_cards
47
- echo "Configuring ALL cards via BOOTP/IPv4"
48
- net_bootp
49
- # uncomment here for IPv6 support (not tested)
50
- #echo "Configuring ALL cards via BOOTP/IPv6"
51
- #net_ipv6_autoconf
52
- net_ls_addr
53
- net_ls_routes
54
- net_ls_dns
55
- echo Trying to ping proxy_httpboot_host: <%= proxy_httpboot_host %>
56
- ping --count 1 <%= proxy_httpboot_host %> || echo Ping to proxy_httpboot_host failed or ping command not available.
57
- echo Trying to ping proxy_template_host: <%= proxy_template_host %>
58
- ping --count 1 <%= proxy_template_host %> || echo Ping to proxy_template_host failed or ping command not available.
59
- sleep 5
60
- set root=(<%= proxy_proto %>,<%= proxy_httpboot_host %>:<%= proxy_port %>)
61
- # The variable will not survive configfile fetch, therefore absolute path
62
- # must be used in the chainloaded template.
63
- # https://bugzilla.redhat.com/show_bug.cgi?id=1842893
64
- set http_path=/httpboot/
65
- set default=efi_<%= proxy_proto %>
66
- <% (0..32).each do |i| -%>
67
- echo "Trying efinet<%= i %> via <%= proxy_proto %>://<%= proxy_template_host %>:<%= proxy_port %>/unattended/PXEGrub2?mac=$net_efinet<%= i %>_dhcp_mac"
68
- set net_default_mac=$net_efinet<%= i %>_dhcp_mac
69
- sleep 5
70
- configfile (<%= proxy_proto %>,<%= proxy_template_host %>:<%= proxy_port %>)/unattended/PXEGrub2?mac=$net_efinet<%= i %>_dhcp_mac
71
- <% end -%>
72
-
73
- echo "Could not find a host with PXEGrub2 template and one of the MAC addresses!"
74
- echo "The system will poweroff in few minutes..."
75
- sleep 500
76
- poweroff
@@ -1,51 +0,0 @@
1
- <%#
2
- name: Boot disk iPXE - generic host
3
- snippet: false
4
- model: ProvisioningTemplate
5
- kind: Bootdisk
6
- description: |
7
- Example foreman_bootdisk generic host template
8
-
9
- This template is generic, but it will chainload to Foreman so expects the
10
- host to be registered already.
11
-
12
- It loops through all interfaces using DHCP, requesting a template from
13
- Foreman in the hope that one of the MACs or IPs matches.
14
- -%>
15
- #!ipxe
16
-
17
- echo Foreman Bootdisk: Generic image
18
-
19
- # loop over net* until we can get a template
20
- <% url = bootdisk_chain_url %>
21
- <% (0..32).each do |i| -%>
22
- :net<%= i %>
23
- isset ${net<%= i -%>/mac} || goto no_nic
24
- echo net<%= i -%> is a ${net<%= i -%>/chip} with MAC ${net<%= i -%>/mac}
25
- dhcp net<%= i %> || goto net<%= i+1 %>
26
- chain <%= url %>${net<%= i -%>/mac} || goto net<%= i+1 %>
27
- exit 0
28
- <% end -%>
29
- echo Failed to chainload from any network interface, fallback to static.
30
- ifstat
31
-
32
- :no_nic
33
- echo -n Enter interface name to boot from (e.g. net0): && read interface
34
- isset ${${interface}/mac} && goto get_static_ip
35
- echo Interface ${interface} is not initialized, try again
36
- goto no_nic
37
-
38
- :get_static_ip
39
- ifopen ${interface}
40
- echo Please enter IP details for ${interface}
41
- echo
42
- echo -n IP address : && read ${interface}/ip
43
- echo -n Subnet mask : && read ${interface}/netmask
44
- echo -n Default gateway : && read ${interface}/gateway
45
- echo -n DNS server : && read dns
46
- chain <%= url %>${${interface}/mac} || goto boot_failure
47
- exit 0
48
-
49
- :boot_failure
50
- echo Cannot continue, spawning shell
51
- shell
@@ -1,39 +0,0 @@
1
- <%#
2
- name: Boot disk iPXE - generic static host
3
- snippet: false
4
- model: ProvisioningTemplate
5
- kind: Bootdisk
6
- description: |
7
- Generic host template with interactive static IP configuration. Tokens
8
- must be disabled in order to access templates via MAC addresses.
9
- -%>
10
- #!ipxe
11
-
12
- <% (0..32).each do |i| -%>
13
- :net<%= i %>
14
- isset ${net<%= i -%>/mac} || goto configure
15
- echo Found ${net<%= i -%>/mac} as net<%= i -%> on a ${net<%= i -%>/chip}
16
- goto net<%= i+1 %>
17
- <% end -%>
18
-
19
- :configure
20
- echo -n Interface (e.g. net0): && read interface
21
- iseq ${interface} n && goto reboot ||
22
- iseq ${interface} N && goto reboot ||
23
-
24
- ifopen ${interface}
25
- echo Please enter IPv4 details for ${interface}
26
- echo
27
-
28
- echo -n IP address: && read ${interface}/ip
29
- echo -n Subnet mask: && read ${interface}/netmask
30
- echo -n Default gateway: && read ${interface}/gateway
31
- echo -n DNS server: && read dns
32
-
33
- chain <%= bootdisk_chain_url %>${${interface}/mac} || goto reboot
34
- exit 0
35
-
36
- :reboot
37
- echo Unable to continue, rebooting...
38
- sleep 30
39
- exit 1
@@ -1,80 +0,0 @@
1
- <%#
2
- name: Boot disk iPXE - host
3
- snippet: false
4
- model: ProvisioningTemplate
5
- kind: Bootdisk
6
- description: |
7
- Example foreman_bootdisk host template
8
- This template is rendered for use inside a host-specific boot disk.
9
- -%>
10
- #!ipxe
11
-
12
- <%
13
- interface = @host.provision_interface
14
- bootdisk_raise(N_('Host has no provisioning interface defined')) unless interface
15
- bootdisk_raise(N_('Host has no IPv4 or IPv6 address defined')) unless interface.ip.present? || interface.ip6.present?
16
- bootdisk_raise(N_('Host has no subnet defined')) unless interface.subnet || interface.subnet6
17
- bootdisk_raise(N_('Host has no domain defined')) unless interface.domain
18
- if interface.ip.present? && interface.subnet
19
- ip = interface.ip
20
- subnet = interface.subnet
21
- elsif interface.ip6.present? && interface.subnet6
22
- ip = interface.ip6
23
- subnet = interface.subnet6
24
- bootdisk_raise(N_('Host bootdisk does not work with static IPv6'))
25
- else
26
- bootdisk_raise(N_('Both IP and Subnet must be set'))
27
- end
28
-
29
- mask = subnet.mask
30
- gw = subnet.gateway
31
- dns = subnet.dns_servers.first
32
- %>
33
-
34
- echo Foreman Bootdisk: Host image (<%= @host.name %>)
35
-
36
- # loop over net* until the host's MAC matches
37
- <% (0..32).each do |i| -%>
38
- :net<%= i %>
39
- isset ${net<%= i -%>/mac} || goto no_nic
40
- echo net<%= i -%> is a ${net<%= i -%>/chip} with MAC ${net<%= i -%>/mac}
41
- iseq ${net<%= i -%>/mac} <%= interface.mac -%> || goto net<%= i+1 %>
42
- set idx:int32 <%= i %>
43
- goto loop_success
44
- <% end -%>
45
-
46
- :loop_success
47
- echo Configuring net${idx} for static IP address <%= ip %>
48
- ifopen net${idx}
49
- # netX = last opened NIC
50
- set netX/ip <%= ip %>
51
- set netX/netmask <%= mask %>
52
- <% if gw.present? %>
53
- set netX/gateway <%= gw %>
54
- <% end %>
55
- ifstat net${idx}
56
- route
57
-
58
- # Note: When multiple DNS servers are specified, only the first
59
- # server will be used. See: http://ipxe.org/cfg/dns
60
- <% if dns.present? -%>
61
- echo Using DNS <%= dns %>
62
- set dns <%= dns %>
63
- set domain <%= interface.domain.to_s %>
64
- <% end %>
65
-
66
- echo Trying to ping Gateway: ${netX/gateway}
67
- ping --count 1 ${netX/gateway} || echo Ping to Gateway failed or ping command not available.
68
- <% if dns.present? -%>
69
- echo Trying to ping DNS: ${netX/dns}
70
- ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not available.
71
- <% end %>
72
-
73
- # Chainload from Foreman rather than embedding OS info here, so the behaviour
74
- # is entirely dynamic.
75
- chain <%= bootdisk_chain_url %>
76
- exit 0
77
-
78
- :no_nic
79
- echo Cannot find interface with MAC <%= interface.mac %>, spawning shell
80
- shell
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class FixBootdiskSettingsCategoryToDsl < ActiveRecord::Migration[6.0]
4
- def up
5
- Setting.where(category: 'Setting::Bootdisk').update_all(category: 'Setting')
6
- end
7
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- def read_bootdisk_template(filename)
4
- File.read(File.join(ForemanBootdisk::Engine.root, 'app', 'views', 'foreman_bootdisk', filename))
5
- end
6
-
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|
10
- template.attributes = {
11
- template_kind_id: kind.id,
12
- snippet: false,
13
- template: content
14
- }
15
- end
16
- tmpl.attributes = {
17
- template: content,
18
- default: true,
19
- vendor: "Foreman boot disk"
20
- }
21
- tmpl.locked = true
22
- tmpl.organizations = Organization.unscoped.all if SETTINGS[:organizations_enabled]
23
- tmpl.locations = Location.unscoped.all if SETTINGS[:locations_enabled]
24
-
25
- metadata = Template.parse_metadata(content)
26
- tmpl.description = metadata['description']
27
-
28
- tmpl.save!(validate: false) if tmpl.changes.present?
29
- end
30
-
31
- ProvisioningTemplate.without_auditing do
32
- ensure_bootdisk_template("Boot disk iPXE - host", read_bootdisk_template("host.erb"))
33
- ensure_bootdisk_template("Boot disk iPXE - generic host", read_bootdisk_template("generic_host.erb"))
34
- ensure_bootdisk_template("Boot disk Grub2 EFI - generic host", read_bootdisk_template("generic_efi_host.erb"))
35
- ensure_bootdisk_template("Boot disk iPXE - generic static host", read_bootdisk_template("generic_static_host.erb"))
36
- end