foreman_bootdisk 22.0.3 → 23.1.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/concerns/foreman_bootdisk/compute_resources/proxmox.rb +50 -0
  3. data/app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb +1 -1
  4. data/lib/foreman_bootdisk/engine.rb +6 -1
  5. data/lib/foreman_bootdisk/version.rb +1 -1
  6. data/webpack/src/extensions/host/HostBootdiskButtons.js +1 -1
  7. metadata +4 -39
  8. data/lib/foreman_bootdisk/engine.rb.orig +0 -159
  9. data/locale/ca/foreman_bootdisk.edit.po +0 -364
  10. data/locale/ca/foreman_bootdisk.po.time_stamp +0 -0
  11. data/locale/cs_CZ/foreman_bootdisk.edit.po +0 -362
  12. data/locale/cs_CZ/foreman_bootdisk.po.time_stamp +0 -0
  13. data/locale/de/foreman_bootdisk.edit.po +0 -369
  14. data/locale/de/foreman_bootdisk.po.time_stamp +0 -0
  15. data/locale/en/foreman_bootdisk.edit.po +0 -360
  16. data/locale/en/foreman_bootdisk.po.time_stamp +0 -0
  17. data/locale/en_GB/foreman_bootdisk.edit.po +0 -365
  18. data/locale/en_GB/foreman_bootdisk.po.time_stamp +0 -0
  19. data/locale/es/foreman_bootdisk.edit.po +0 -366
  20. data/locale/es/foreman_bootdisk.po.time_stamp +0 -0
  21. data/locale/fr/foreman_bootdisk.edit.po +0 -366
  22. data/locale/fr/foreman_bootdisk.po.time_stamp +0 -0
  23. data/locale/it/foreman_bootdisk.edit.po +0 -363
  24. data/locale/it/foreman_bootdisk.po.time_stamp +0 -0
  25. data/locale/ja/foreman_bootdisk.edit.po +0 -364
  26. data/locale/ja/foreman_bootdisk.po.time_stamp +0 -0
  27. data/locale/ka/foreman_bootdisk.edit.po +0 -362
  28. data/locale/ka/foreman_bootdisk.po.time_stamp +0 -0
  29. data/locale/ko/foreman_bootdisk.edit.po +0 -361
  30. data/locale/ko/foreman_bootdisk.po.time_stamp +0 -0
  31. data/locale/pt_BR/foreman_bootdisk.edit.po +0 -367
  32. data/locale/pt_BR/foreman_bootdisk.po.time_stamp +0 -0
  33. data/locale/ru/foreman_bootdisk.edit.po +0 -366
  34. data/locale/ru/foreman_bootdisk.po.time_stamp +0 -0
  35. data/locale/sv_SE/foreman_bootdisk.edit.po +0 -363
  36. data/locale/sv_SE/foreman_bootdisk.po.time_stamp +0 -0
  37. data/locale/zh_CN/foreman_bootdisk.edit.po +0 -362
  38. data/locale/zh_CN/foreman_bootdisk.po.time_stamp +0 -0
  39. data/locale/zh_TW/foreman_bootdisk.edit.po +0 -362
  40. 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: 7198cdd107f1122f317d721826a524a8aaf42191b5fae7f0a0f28cbdce876240
4
- data.tar.gz: 3718c74b4c6028d1ecd0c688f637b6fa1bf249203ca976897e5056669462a597
3
+ metadata.gz: 7115babe231d5d12bf7cf520823714559a7f9c9435df2aff0f1e30e431bef3d7
4
+ data.tar.gz: e0ef9f391e1a762225c6e02c81c8312645d4639420b53db8f40f88f7bf7d608a
5
5
  SHA512:
6
- metadata.gz: 427b3cc233728bb56d571a6c0e883bed4526d4045e0418643c7d1e72ebe84a6150cd6481708103aa9953ab9876ab761932827aed02cd59f825c0301b7c944607
7
- data.tar.gz: c621b821c7b79b89c07fd42d1eae40f02ee191a14d4d34bc9eebf905defcec3b3c701d1a0343a50fafb178b30f102eccfd7910533c6d20975627b9d27d37f5b9
6
+ metadata.gz: 7a528c3019743c86ce6920ae26c3ede482c73ab60a31b9dc631c3eb5bedb64c1735b8b05250e5c8e41f0154689f5e06b01a97ea484bdf86a279da1c9773d9a11
7
+ data.tar.gz: f0291a50c6b5ed15cedbeb76fd3862ccafd830b6ae1cb8fad0f90eed3e51ba3c796bdef5c00b067f4159b97b4d1ca63f005605f52bb00879e75c1696e089dea5
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ForemanBootdisk
4
+ module ComputeResources
5
+ module Proxmox
6
+ CDROM_VOLUME = 'ide2'
7
+
8
+ def capabilities
9
+ super + [:bootdisk]
10
+ end
11
+
12
+ def iso_upload(iso, vm_uuid)
13
+ server = find_vm_by_uuid(vm_uuid)
14
+ server.ssh_options = { password: fog_credentials[:proxmox_password] }
15
+ server.ssh_ip_address = proxmox_host
16
+ server.username = client.credentials[:current_user].split('@').first
17
+ server.scp_upload(iso, '/var/lib/vz/template/iso/')
18
+ server.reload
19
+ storage = storages(server.node_id, 'iso')[0]
20
+ storage.volumes.any? { |v| v.volid.include? File.basename(iso) }
21
+ end
22
+
23
+ def iso_attach(iso, vm_uuid)
24
+ server = find_vm_by_uuid(vm_uuid)
25
+ storage = storages(server.node_id, 'iso')[0]
26
+ volume = storage.volumes.detect { |v| v.volid.include? File.basename(iso) }
27
+ disks = server.disks.map { |disk| disk.split(":")[0] }.join(";")
28
+ server.update({ ide2: "#{volume.volid},media=cdrom" })
29
+ server.update({ boot: "order=ide2;#{disks}" })
30
+ server.reboot
31
+ end
32
+
33
+ def iso_detach(vm_uuid)
34
+ server = find_vm_by_uuid(vm_uuid)
35
+
36
+ # get volid to delete iso after detaching from vm
37
+ volid = server.volumes.get(CDROM_VOLUME).volid
38
+ server.update({ ide2: "none,media=cdrom" })
39
+
40
+ # cdrom will be ejected on next power off
41
+ server.detach(CDROM_VOLUME)
42
+
43
+ # delete the iso file from proxmox server
44
+ storage = storages(server.node_id, 'iso')[0]
45
+ volume = storage.volumes.detect { |v| v.volid.include? volid }
46
+ volume.destroy
47
+ end
48
+ end
49
+ end
50
+ end
@@ -12,7 +12,7 @@ module ForemanBootdisk
12
12
  if args[:provision_method] == 'bootdisk'
13
13
  args[:cdroms] = [new_cdrom]
14
14
  args[:boot_order] = %w[cdrom disk]
15
- args[:boot_retry] = 10
15
+ args[:boot_retry] = 10 * 1000 # boot_retry is in ms. Shortest is 10s
16
16
  end
17
17
  args
18
18
  end
@@ -26,7 +26,7 @@ module ForemanBootdisk
26
26
  initializer 'foreman_bootdisk.register_plugin', before: :finisher_hook do |app|
27
27
  app.reloader.to_prepare do
28
28
  Foreman::Plugin.register :foreman_bootdisk do
29
- requires_foreman '>= 3.13'
29
+ requires_foreman '>= 3.15'
30
30
  # Add Global files for extending foreman-core components and routes
31
31
  register_global_js_file 'global'
32
32
  register_gettext
@@ -140,6 +140,7 @@ module ForemanBootdisk
140
140
  Host::Managed.prepend ForemanBootdisk::HostExt
141
141
  Host::Managed.include ForemanBootdisk::Orchestration::Compute
142
142
  Foreman::Model::Vmware.prepend ForemanBootdisk::ComputeResources::Vmware if Foreman::Model::Vmware.available?
143
+ ForemanFogProxmox::Proxmox.prepend ForemanBootdisk::ComputeResources::Proxmox if ForemanBootdisk.with_proxmox?
143
144
  rescue StandardError => e
144
145
  Rails.logger.warn "#{ForemanBootdisk::ENGINE_NAME}: skipping engine hook (#{e})"
145
146
  end
@@ -149,4 +150,8 @@ module ForemanBootdisk
149
150
  def self.logger
150
151
  Foreman::Logging.logger('foreman_bootdisk')
151
152
  end
153
+
154
+ def self.with_proxmox?
155
+ Foreman::Plugin.installed?('foreman_fog_proxmox')
156
+ end
152
157
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanBootdisk
4
- VERSION = '22.0.3'
4
+ VERSION = '23.1.0'
5
5
  end
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { useSelector, useDispatch } from 'react-redux';
3
3
 
4
- import { DropdownItem, DropdownGroup } from '@patternfly/react-core';
4
+ import { DropdownItem, DropdownGroup } from '@patternfly/react-core/deprecated';
5
5
  import {
6
6
  BanIcon,
7
7
  BuildIcon,
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_bootdisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 22.0.3
4
+ version: 23.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Cleal
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-20 00:00:00.000000000 Z
10
+ date: 2025-06-03 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: theforeman-rubocop
@@ -68,6 +67,7 @@ files:
68
67
  - app/lib/foreman_bootdisk/scope/full_host_bootdisk.rb
69
68
  - app/lib/foreman_bootdisk/scope/full_host_bootdisk_efi.rb
70
69
  - app/lib/foreman_bootdisk/template_helpers.rb
70
+ - app/models/concerns/foreman_bootdisk/compute_resources/proxmox.rb
71
71
  - app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb
72
72
  - app/models/concerns/foreman_bootdisk/host_ext.rb
73
73
  - app/models/concerns/foreman_bootdisk/orchestration/compute.rb
@@ -91,77 +91,44 @@ files:
91
91
  - db/migrate/20221102105354_fix_bootdisk_settings_category_to_dsl.rb
92
92
  - lib/foreman_bootdisk.rb
93
93
  - lib/foreman_bootdisk/engine.rb
94
- - lib/foreman_bootdisk/engine.rb.orig
95
94
  - lib/foreman_bootdisk/version.rb
96
95
  - lib/tasks/bootdisk.rake
97
96
  - locale/Makefile
98
97
  - locale/ca/LC_MESSAGES/foreman_bootdisk.mo
99
- - locale/ca/foreman_bootdisk.edit.po
100
98
  - locale/ca/foreman_bootdisk.po
101
- - locale/ca/foreman_bootdisk.po.time_stamp
102
99
  - locale/cs_CZ/LC_MESSAGES/foreman_bootdisk.mo
103
- - locale/cs_CZ/foreman_bootdisk.edit.po
104
100
  - locale/cs_CZ/foreman_bootdisk.po
105
- - locale/cs_CZ/foreman_bootdisk.po.time_stamp
106
101
  - locale/de/LC_MESSAGES/foreman_bootdisk.mo
107
- - locale/de/foreman_bootdisk.edit.po
108
102
  - locale/de/foreman_bootdisk.po
109
- - locale/de/foreman_bootdisk.po.time_stamp
110
103
  - locale/en/LC_MESSAGES/foreman_bootdisk.mo
111
- - locale/en/foreman_bootdisk.edit.po
112
104
  - locale/en/foreman_bootdisk.po
113
- - locale/en/foreman_bootdisk.po.time_stamp
114
105
  - locale/en_GB/LC_MESSAGES/foreman_bootdisk.mo
115
- - locale/en_GB/foreman_bootdisk.edit.po
116
106
  - locale/en_GB/foreman_bootdisk.po
117
- - locale/en_GB/foreman_bootdisk.po.time_stamp
118
107
  - locale/es/LC_MESSAGES/foreman_bootdisk.mo
119
- - locale/es/foreman_bootdisk.edit.po
120
108
  - locale/es/foreman_bootdisk.po
121
- - locale/es/foreman_bootdisk.po.time_stamp
122
109
  - locale/foreman_bootdisk.pot
123
110
  - locale/fr/LC_MESSAGES/foreman_bootdisk.mo
124
- - locale/fr/foreman_bootdisk.edit.po
125
111
  - locale/fr/foreman_bootdisk.po
126
- - locale/fr/foreman_bootdisk.po.time_stamp
127
112
  - locale/gemspec.rb
128
113
  - locale/it/LC_MESSAGES/foreman_bootdisk.mo
129
- - locale/it/foreman_bootdisk.edit.po
130
114
  - locale/it/foreman_bootdisk.po
131
- - locale/it/foreman_bootdisk.po.time_stamp
132
115
  - locale/ja/LC_MESSAGES/foreman_bootdisk.mo
133
- - locale/ja/foreman_bootdisk.edit.po
134
116
  - locale/ja/foreman_bootdisk.po
135
- - locale/ja/foreman_bootdisk.po.time_stamp
136
117
  - locale/ka/LC_MESSAGES/foreman_bootdisk.mo
137
- - locale/ka/foreman_bootdisk.edit.po
138
118
  - locale/ka/foreman_bootdisk.po
139
- - locale/ka/foreman_bootdisk.po.time_stamp
140
119
  - locale/ko/LC_MESSAGES/foreman_bootdisk.mo
141
- - locale/ko/foreman_bootdisk.edit.po
142
120
  - locale/ko/foreman_bootdisk.po
143
- - locale/ko/foreman_bootdisk.po.time_stamp
144
121
  - locale/pt_BR/LC_MESSAGES/foreman_bootdisk.mo
145
- - locale/pt_BR/foreman_bootdisk.edit.po
146
122
  - locale/pt_BR/foreman_bootdisk.po
147
- - locale/pt_BR/foreman_bootdisk.po.time_stamp
148
123
  - locale/ru/LC_MESSAGES/foreman_bootdisk.mo
149
- - locale/ru/foreman_bootdisk.edit.po
150
124
  - locale/ru/foreman_bootdisk.po
151
- - locale/ru/foreman_bootdisk.po.time_stamp
152
125
  - locale/sv_SE/LC_MESSAGES/foreman_bootdisk.mo
153
- - locale/sv_SE/foreman_bootdisk.edit.po
154
126
  - locale/sv_SE/foreman_bootdisk.po
155
- - locale/sv_SE/foreman_bootdisk.po.time_stamp
156
127
  - locale/zanata.xml
157
128
  - locale/zh_CN/LC_MESSAGES/foreman_bootdisk.mo
158
- - locale/zh_CN/foreman_bootdisk.edit.po
159
129
  - locale/zh_CN/foreman_bootdisk.po
160
- - locale/zh_CN/foreman_bootdisk.po.time_stamp
161
130
  - locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo
162
- - locale/zh_TW/foreman_bootdisk.edit.po
163
131
  - locale/zh_TW/foreman_bootdisk.po
164
- - locale/zh_TW/foreman_bootdisk.po.time_stamp
165
132
  - package.json
166
133
  - webpack/__mocks__/foremanReact/common/HOC.js
167
134
  - webpack/__mocks__/foremanReact/common/I18n.js
@@ -182,7 +149,6 @@ homepage: https://github.com/theforeman/foreman_bootdisk
182
149
  licenses:
183
150
  - GPL-3.0
184
151
  metadata: {}
185
- post_install_message:
186
152
  rdoc_options: []
187
153
  require_paths:
188
154
  - lib
@@ -200,8 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
166
  - !ruby/object:Gem::Version
201
167
  version: '0'
202
168
  requirements: []
203
- rubygems_version: 3.5.23
204
- signing_key:
169
+ rubygems_version: 3.6.2
205
170
  specification_version: 4
206
171
  summary: Create boot disks to provision hosts with Foreman
207
172
  test_files: []
@@ -1,159 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'foreman_bootdisk'
4
- require 'fast_gettext'
5
- require 'gettext_i18n_rails'
6
-
7
- module ForemanBootdisk
8
- class Engine < ::Rails::Engine
9
- engine_name 'foreman_bootdisk'
10
- isolate_namespace ForemanBootdisk
11
-
12
- initializer 'foreman_bootdisk.mount_engine' do |app|
13
- app.routes_reloader.paths << "#{ForemanBootdisk::Engine.root}/config/routes/mount_engine.rb"
14
- end
15
-
16
- initializer 'foreman_bootdisk.load_app_instance_data' do |app|
17
- ForemanBootdisk::Engine.paths['db/migrate'].existent.each do |path|
18
- app.config.paths['db/migrate'] << path
19
- end
20
- end
21
-
22
- initializer 'foreman_bootdisk.apipie' do
23
- Apipie.configuration.checksum_path += ['/bootdisk/api/']
24
- end
25
-
26
- initializer 'foreman_bootdisk.register_plugin', before: :finisher_hook do |app|
27
- app.reloader.to_prepare do
28
- Foreman::Plugin.register :foreman_bootdisk do
29
- requires_foreman '>= 3.13'
30
- # Add Global files for extending foreman-core components and routes
31
- register_global_js_file 'global'
32
- register_gettext
33
-
34
- security_block :bootdisk do |_map|
35
- permission :download_bootdisk, 'foreman_bootdisk/disks': %i[generic host full_host help bootdisk_options],
36
- 'foreman_bootdisk/subnet_disks': [:subnet],
37
- 'foreman_bootdisk/api/v2/disks': %i[generic host],
38
- 'foreman_bootdisk/api/v2/subnet_disks': [:subnet]
39
- end
40
-
41
- role 'Boot disk access', [:download_bootdisk], 'Role granting permissions to download bootdisks'
42
- add_all_permissions_to_default_roles
43
-
44
- apipie_documented_controllers ["#{ForemanBootdisk::Engine.root}/app/controllers/foreman_bootdisk/api/v2/*.rb"]
45
- ApipieDSL.configuration.dsl_classes_matchers += [
46
- "#{ForemanBootdisk::Engine.root}/app/lib/foreman_bootdisk/scope/*.rb"
47
- ]
48
- provision_method 'bootdisk', N_('Boot disk based')
49
- allowed_template_helpers :bootdisk_chain_url, :bootdisk_raise
50
-
51
- <<<<<<< HEAD
52
- extend_page "subnets/index" do |cx|
53
- cx.add_pagelet :subnet_index_action_buttons, name: 'Bootdisk', partial: 'subnets/bootdisk_action_buttons'
54
- cx.add_pagelet :subnet_index_title_buttons, name: 'Bootdisk', partial: 'subnets/bootdisk_title_buttons'
55
- end
56
- =======
57
- apipie_documented_controllers ["#{ForemanBootdisk::Engine.root}/app/controllers/foreman_bootdisk/api/v2/*.rb"]
58
- ApipieDSL.configuration.dsl_classes_matchers += [
59
- "#{ForemanBootdisk::Engine.root}/app/lib/foreman_bootdisk/scope/*.rb"
60
- ]
61
- provision_method 'bootdisk', N_('Boot disk based')
62
- extend_template_helpers ForemanBootdisk::TemplateHelpers
63
- >>>>>>> 968ca20 (Fixes #37792 - Safe mode and bootdisk_* template helpers)
64
-
65
- settings do
66
- category :bootdisk, N_("Boot disk") do
67
- ipxe = ['/usr/lib/ipxe'].find { |p| File.exist?(p) } || '/usr/share/ipxe'
68
- isolinux = ['/usr/lib/ISOLINUX'].find { |p| File.exist?(p) } || '/usr/share/syslinux'
69
- syslinux = ['/usr/lib/syslinux/modules/bios', '/usr/lib/syslinux'].find { |p| File.exist?(p) } || '/usr/share/syslinux'
70
- grub2 = ['/var/lib/tftpboot/grub2'].find { |p| File.exist?(p) } || '/var/lib/foreman/bootdisk'
71
- templates = -> {
72
- Hash[ProvisioningTemplate.where(template_kind: TemplateKind.where(name: 'Bootdisk')).map { |temp| [temp[:name], temp[:name]] }]
73
- }
74
-
75
- setting "bootdisk_ipxe_dir",
76
- type: :string,
77
- default: ipxe,
78
- full_name: N_("iPXE directory"),
79
- description: N_("Path to directory containing iPXE images")
80
-
81
- setting "bootdisk_isolinux_dir",
82
- type: :string,
83
- default: isolinux,
84
- full_name: N_("ISOLINUX directory"),
85
- description: N_("Path to directory containing isolinux images")
86
-
87
- setting "bootdisk_syslinux_dir",
88
- type: :string,
89
- default: syslinux,
90
- full_name: N_("SYSLINUX directory"),
91
- description: N_("Path to directory containing syslinux images")
92
-
93
- setting "bootdisk_grub2_dir",
94
- type: :string,
95
- default: grub2,
96
- full_name: N_("Grub2 directory"),
97
- description: N_("Path to directory containing grubx64.efi and shimx64.efi")
98
-
99
- setting "bootdisk_host_template",
100
- type: :string,
101
- collection: templates,
102
- default: "Boot disk iPXE - host",
103
- full_name: N_("Host image template"),
104
- description: N_("iPXE template to use for host-specific boot disks")
105
-
106
- setting "bootdisk_generic_host_template",
107
- type: :string,
108
- collection: templates,
109
- default: "Boot disk iPXE - generic host",
110
- full_name: N_("Generic image template"),
111
- description: N_("iPXE template to use for generic host boot disks")
112
-
113
- setting "bootdisk_generic_efi_host_template",
114
- type: :string,
115
- collection: templates,
116
- default: "Boot disk Grub2 EFI - generic host",
117
- full_name: N_("Generic Grub2 EFI image template"),
118
- description: N_("iPXE template to use for generic EFI host boot disks")
119
-
120
- setting "bootdisk_mkiso_command",
121
- type: :string,
122
- default: "genisoimage",
123
- full_name: N_("ISO generation command"),
124
- description: N_("Command to generate ISO image, use genisoimage or mkisofs")
125
-
126
- setting "bootdisk_cache_media",
127
- type: :boolean,
128
- default: true,
129
- full_name: N_("Installation media caching"),
130
- description: N_("Installation media files will be cached for full host images")
131
-
132
- setting "bootdisk_allowed_types",
133
- type: :array,
134
- default: Setting::Bootdisk.bootdisk_types,
135
- full_name: N_("Allowed bootdisk types"),
136
- description: N_("List of allowed bootdisk types, remove type to disable it")
137
- end
138
- end
139
- end
140
- end
141
- end
142
-
143
- config.to_prepare do
144
- begin
145
- ::HostsHelper.prepend ForemanBootdisk::HostsHelperExt
146
- ::SubnetsHelper.include ForemanBootdisk::SubnetsHelperExt
147
- Host::Managed.prepend ForemanBootdisk::HostExt
148
- Host::Managed.include ForemanBootdisk::Orchestration::Compute
149
- Foreman::Model::Vmware.prepend ForemanBootdisk::ComputeResources::Vmware if Foreman::Model::Vmware.available?
150
- rescue StandardError => e
151
- Rails.logger.warn "#{ForemanBootdisk::ENGINE_NAME}: skipping engine hook (#{e})"
152
- end
153
- end
154
- end
155
-
156
- def self.logger
157
- Foreman::Logging.logger('foreman_bootdisk')
158
- end
159
- end