foreman_bootdisk 17.0.2 → 17.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yaml +19 -0
- data/.tx/config +1 -1
- data/AUTHORS +4 -0
- data/app/controllers/concerns/allowed_actions.rb +16 -0
- data/app/controllers/foreman_bootdisk/api/v2/disks_controller.rb +4 -0
- data/app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb +7 -0
- data/app/controllers/foreman_bootdisk/disks_controller.rb +3 -0
- data/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb +62 -36
- data/app/lib/foreman_bootdisk/scope/bootdisk.rb +24 -0
- data/app/models/concerns/foreman_bootdisk/host_ext.rb +6 -0
- data/app/models/concerns/foreman_bootdisk/orchestration/compute.rb +10 -3
- data/app/models/setting/bootdisk.rb +10 -1
- data/app/services/foreman_bootdisk/iso_generator.rb +23 -5
- data/app/views/foreman_bootdisk/generic_efi_host.erb +4 -0
- data/app/views/foreman_bootdisk/host.erb +7 -0
- data/lib/foreman_bootdisk/engine.rb +3 -0
- data/lib/foreman_bootdisk/version.rb +1 -1
- data/lib/tasks/bootdisk.rake +1 -19
- data/locale/action_names.rb +3 -1
- metadata +10 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca80bb43629c291c9d6b27bb8c94ebd10fcc2e6e267378e4852ab42bdcee0088
|
4
|
+
data.tar.gz: 743d4a31beef4d80d6ab5b025cf6261bbbb11cb62eb82b65d8f7c5aaed58c9fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1915d2f7f01f58ec795f343707fe7a6d24f49af0ce6fb6ee9577f3279749e74f5cfb74b7ee707f3eea0e972b92344bc7d10a30f7be9556bffe8be2a39315526d
|
7
|
+
data.tar.gz: b21943b356b209d60ad7cd1bc655a81c042ef93534fb94f719c271688f64f42a2f2ea3ba21a10280b388861fd061d1e08df498de216dc233f27a92e10065c942
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
|
3
|
+
on: [pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
rubocop:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
env:
|
9
|
+
BUNDLE_FOREMAN: '0'
|
10
|
+
BUNDLE_WITHOUT: development:test
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- name: Setup Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 2.5
|
17
|
+
bundler-cache: true
|
18
|
+
- name: Run rubocop
|
19
|
+
run: bundle exec rubocop -P --format github
|
data/.tx/config
CHANGED
data/AUTHORS
CHANGED
@@ -4,6 +4,7 @@ Bryan Kearney
|
|
4
4
|
crito
|
5
5
|
Damon Maria
|
6
6
|
Dominic Cleal
|
7
|
+
Dominik Matoulek
|
7
8
|
Greg Sutcliffe
|
8
9
|
Ido Kanner
|
9
10
|
Jon Fautley
|
@@ -13,13 +14,16 @@ Lukas Zapletal
|
|
13
14
|
Lukáš Zapletal
|
14
15
|
Marek Hulan
|
15
16
|
Marek Hulán
|
17
|
+
Markus Bucher
|
16
18
|
Martin Bačovský
|
17
19
|
Michael Hofer
|
18
20
|
Michael Moll
|
19
21
|
Ohad Levy
|
22
|
+
Oleh Fedorenko
|
20
23
|
Ondrej Prazak
|
21
24
|
Ondřej Ezr
|
22
25
|
Ondřej Pražák
|
26
|
+
Pat Riehecky
|
23
27
|
Robert Antoni Buj Gelonch
|
24
28
|
Rohan21Lobo
|
25
29
|
Ronald van Zantvoort
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AllowedActions
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
def bootdisk_type_allowed?(action = params[:action])
|
5
|
+
return true if Setting::Bootdisk.allowed_types&.include?(action)
|
6
|
+
|
7
|
+
message = _('This type of bootdisk is not allowed. Please contact administrator.')
|
8
|
+
if api_request?
|
9
|
+
render_error :custom_error, status: :unprocessable_entity, locals: { message: message}
|
10
|
+
else
|
11
|
+
error(message)
|
12
|
+
redirect_back(fallback_location: '/')
|
13
|
+
end
|
14
|
+
false
|
15
|
+
end
|
16
|
+
end
|
@@ -7,11 +7,13 @@ module ForemanBootdisk
|
|
7
7
|
module V2
|
8
8
|
class DisksController < ::Api::V2::BaseController
|
9
9
|
include ::Api::Version2
|
10
|
+
include AllowedActions
|
10
11
|
|
11
12
|
resource_description do
|
12
13
|
api_base_url '/bootdisk/api'
|
13
14
|
end
|
14
15
|
|
16
|
+
before_action :bootdisk_type_allowed?, only: :generic
|
15
17
|
before_action :find_resource, only: :host
|
16
18
|
skip_after_action :log_response_body
|
17
19
|
|
@@ -34,10 +36,12 @@ module ForemanBootdisk
|
|
34
36
|
def host
|
35
37
|
host = @disk
|
36
38
|
if params[:full]
|
39
|
+
return unless bootdisk_type_allowed?('full_host')
|
37
40
|
ForemanBootdisk::ISOGenerator.generate_full_host(host) do |iso|
|
38
41
|
send_file(iso, filename: "#{host.name}#{ForemanBootdisk::ISOGenerator.token_expiry(host)}.iso")
|
39
42
|
end
|
40
43
|
else
|
44
|
+
return unless bootdisk_type_allowed?
|
41
45
|
# EFI not supported for iPXE host bootdisk
|
42
46
|
tmpl = host.bootdisk_template_render
|
43
47
|
ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso|
|
@@ -7,11 +7,14 @@ module ForemanBootdisk
|
|
7
7
|
module V2
|
8
8
|
class SubnetDisksController < ::Api::V2::BaseController
|
9
9
|
include ::Api::Version2
|
10
|
+
include AllowedActions
|
10
11
|
|
11
12
|
resource_description do
|
12
13
|
api_base_url '/bootdisk/api'
|
13
14
|
end
|
14
15
|
|
16
|
+
rescue_from ActiveRecord::RecordNotFound, :with => :subnet_not_found
|
17
|
+
before_action :bootdisk_type_allowed?, only: :subnet
|
15
18
|
before_action :find_resource, only: :subnet
|
16
19
|
|
17
20
|
skip_after_action :log_response_body
|
@@ -42,6 +45,10 @@ module ForemanBootdisk
|
|
42
45
|
def resource_scope
|
43
46
|
Subnet.authorized('view_subnets')
|
44
47
|
end
|
48
|
+
|
49
|
+
def subnet_not_found
|
50
|
+
not_found ("Subnet not found by id '%s'") % params[:id]
|
51
|
+
end
|
45
52
|
end
|
46
53
|
end
|
47
54
|
end
|
@@ -4,6 +4,9 @@ require 'uri'
|
|
4
4
|
|
5
5
|
module ForemanBootdisk
|
6
6
|
class DisksController < ::ApplicationController
|
7
|
+
include AllowedActions
|
8
|
+
|
9
|
+
before_action :bootdisk_type_allowed?, except: :help
|
7
10
|
before_action :find_resource, only: %w[host full_host subnet]
|
8
11
|
|
9
12
|
# as this engine is isolated, we need to include url helpers from core explicitly
|
@@ -8,42 +8,7 @@ module ForemanBootdisk
|
|
8
8
|
button_group(
|
9
9
|
select_action_button(
|
10
10
|
_('Boot disk'), { class: 'btn btn-group' },
|
11
|
-
|
12
|
-
_("Host '%s' image") % host.name.split('.')[0],
|
13
|
-
{
|
14
|
-
controller: 'foreman_bootdisk/disks',
|
15
|
-
action: 'host',
|
16
|
-
id: host
|
17
|
-
},
|
18
|
-
class: 'la'
|
19
|
-
),
|
20
|
-
display_bootdisk_link_if_authorized(
|
21
|
-
_("Full host '%s' image") % host.name.split('.')[0],
|
22
|
-
{
|
23
|
-
controller: 'foreman_bootdisk/disks',
|
24
|
-
action: 'full_host',
|
25
|
-
id: host
|
26
|
-
},
|
27
|
-
class: 'la'
|
28
|
-
),
|
29
|
-
content_tag(:li, '', class: 'divider'),
|
30
|
-
display_bootdisk_link_if_authorized(
|
31
|
-
_('Generic image'),
|
32
|
-
{
|
33
|
-
controller: 'foreman_bootdisk/disks',
|
34
|
-
action: 'generic'
|
35
|
-
},
|
36
|
-
class: 'la'
|
37
|
-
),
|
38
|
-
display_bootdisk_for_subnet(host),
|
39
|
-
content_tag(:li, '', class: 'divider'),
|
40
|
-
display_bootdisk_link_if_authorized(
|
41
|
-
_('Help'), {
|
42
|
-
controller: 'foreman_bootdisk/disks',
|
43
|
-
action: 'help'
|
44
|
-
},
|
45
|
-
class: 'la'
|
46
|
-
)
|
11
|
+
host_action_buttons(host)
|
47
12
|
)
|
48
13
|
)
|
49
14
|
)
|
@@ -95,5 +60,66 @@ module ForemanBootdisk
|
|
95
60
|
def bootdisk_authorized_for(options)
|
96
61
|
User.current.allowed_to?(options)
|
97
62
|
end
|
63
|
+
|
64
|
+
def host_action_buttons(host)
|
65
|
+
actions = []
|
66
|
+
|
67
|
+
allowed_actions = Setting::Bootdisk.allowed_types
|
68
|
+
return '' unless allowed_actions
|
69
|
+
|
70
|
+
host_image_link = display_bootdisk_link_if_authorized(
|
71
|
+
_("Host '%s' image") % host.name.split('.')[0],
|
72
|
+
{
|
73
|
+
controller: 'foreman_bootdisk/disks',
|
74
|
+
action: 'host',
|
75
|
+
id: host
|
76
|
+
},
|
77
|
+
class: 'la'
|
78
|
+
)
|
79
|
+
|
80
|
+
full_host_image_link = display_bootdisk_link_if_authorized(
|
81
|
+
_("Full host '%s' image") % host.name.split('.')[0],
|
82
|
+
{
|
83
|
+
controller: 'foreman_bootdisk/disks',
|
84
|
+
action: 'full_host',
|
85
|
+
id: host
|
86
|
+
},
|
87
|
+
class: 'la'
|
88
|
+
)
|
89
|
+
|
90
|
+
generic_image_link = display_bootdisk_link_if_authorized(
|
91
|
+
_('Generic image'),
|
92
|
+
{
|
93
|
+
controller: 'foreman_bootdisk/disks',
|
94
|
+
action: 'generic'
|
95
|
+
},
|
96
|
+
class: 'la'
|
97
|
+
)
|
98
|
+
|
99
|
+
help_link = display_bootdisk_link_if_authorized(
|
100
|
+
_('Help'),
|
101
|
+
{
|
102
|
+
controller: 'foreman_bootdisk/disks',
|
103
|
+
action: 'help'
|
104
|
+
},
|
105
|
+
class: 'la'
|
106
|
+
)
|
107
|
+
|
108
|
+
divider = tag(:li, '', class: 'divider')
|
109
|
+
|
110
|
+
actions << host_image_link if allowed_actions.include?('host')
|
111
|
+
actions << full_host_image_link if allowed_actions.include?('full_host')
|
112
|
+
|
113
|
+
subnet_link = display_bootdisk_for_subnet(host)
|
114
|
+
actions << divider if allowed_actions.include?('generic') || (allowed_actions.include?('subnet') && subnet_link.present?)
|
115
|
+
|
116
|
+
actions << generic_image_link if allowed_actions.include?('generic')
|
117
|
+
actions << subnet_link if allowed_actions.include?('subnet')
|
118
|
+
|
119
|
+
actions << divider
|
120
|
+
actions << help_link
|
121
|
+
|
122
|
+
actions
|
123
|
+
end
|
98
124
|
end
|
99
125
|
end
|
@@ -3,6 +3,20 @@
|
|
3
3
|
module ForemanBootdisk
|
4
4
|
module Scope
|
5
5
|
class Bootdisk < ::Foreman::Renderer::Scope::Provisioning
|
6
|
+
extend ApipieDSL::Class
|
7
|
+
|
8
|
+
apipie :class, 'Macros related to provisioning via boot disk' do
|
9
|
+
name 'Bootdisk'
|
10
|
+
sections only: %w[all provisioning]
|
11
|
+
end
|
12
|
+
|
13
|
+
apipie :method, 'Generates URL for boot chain' do
|
14
|
+
optional :mac, String, 'MAC address of the host', default: 'MAC address of the current host'
|
15
|
+
optional :action, String, 'Bootloader to use', default: 'iPXE'
|
16
|
+
returns String, desc: 'URL for boot chain'
|
17
|
+
example 'bootdisk_chain_url #=> "http://foreman.some.host.fqdn/unattended/iPXE?mac=00%3A11%3A22%3A33%3A44%3A55"'
|
18
|
+
example 'bootdisk_chain_url("00:11:22:33:44:55") #=> "http://foreman.some.host.fqdn/unattended/iPXE?mac=00%3A11%3A22%3A33%3A44%3A55"'
|
19
|
+
end
|
6
20
|
def bootdisk_chain_url(mac = host.try(:mac), action = 'iPXE')
|
7
21
|
url = foreman_url(action)
|
8
22
|
u = URI.parse(url)
|
@@ -14,6 +28,16 @@ module ForemanBootdisk
|
|
14
28
|
u.to_s
|
15
29
|
end
|
16
30
|
|
31
|
+
apipie :method, 'Always raises an error with a description provided as an argument' do
|
32
|
+
desc 'This method is useful for aborting script execution if some of the conditions are not met'
|
33
|
+
list :args, desc: 'Description for the error'
|
34
|
+
raises error: ::Foreman::Exception, desc: 'The error is always being raised'
|
35
|
+
returns nil, desc: "Doesn't return anything"
|
36
|
+
example "<%
|
37
|
+
interface = @host.provision_interface #=> interface = nil
|
38
|
+
bootdisk_raise(N_('Host has no provisioning interface defined')) unless interface #=> Foreman::Exception is raised and the execution of the script is aborted
|
39
|
+
%>"
|
40
|
+
end
|
17
41
|
def bootdisk_raise(*args)
|
18
42
|
raise ::Foreman::Exception.new(*args)
|
19
43
|
end
|
@@ -4,6 +4,8 @@ require 'uri'
|
|
4
4
|
|
5
5
|
module ForemanBootdisk
|
6
6
|
module HostExt
|
7
|
+
extend ApipieDSL::Extension
|
8
|
+
|
7
9
|
def bootdisk_template
|
8
10
|
template = ProvisioningTemplate.unscoped.find_by(name: Setting[:bootdisk_host_template])
|
9
11
|
unless template
|
@@ -36,6 +38,10 @@ module ForemanBootdisk
|
|
36
38
|
def can_be_built?
|
37
39
|
super || (managed? && SETTINGS[:unattended] && bootdisk_build? && !build?)
|
38
40
|
end
|
41
|
+
|
42
|
+
apipie_update :class do
|
43
|
+
property :bootdisk_build?, one_of: [true, false], desc: 'Returns true if provision method for this host is bootdisk, false otherwise'
|
44
|
+
end
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
@@ -42,8 +42,16 @@ module ForemanBootdisk
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def bootdisk_generate_iso_image
|
45
|
-
|
46
|
-
|
45
|
+
if self.build? && self.provisioning_template(kind: :PXELinux) && self.provisioning_template(kind: :PXEGrub2)
|
46
|
+
logger.info format('Generating FULL HOST ISO image for %s', name)
|
47
|
+
ForemanBootdisk::ISOGenerator.generate_full_host(self, dir: Dir.tmpdir) do |image|
|
48
|
+
FileUtils.mv image, bootdisk_isofile
|
49
|
+
end
|
50
|
+
else
|
51
|
+
logger.info format('Generating HOST ISO image for %s', name)
|
52
|
+
ForemanBootdisk::ISOGenerator.generate(ipxe: bootdisk_template_render, dir: Dir.tmpdir) do |image|
|
53
|
+
FileUtils.mv image, bootdisk_isofile
|
54
|
+
end
|
47
55
|
end
|
48
56
|
end
|
49
57
|
|
@@ -60,7 +68,6 @@ module ForemanBootdisk
|
|
60
68
|
end
|
61
69
|
|
62
70
|
def setGenerateIsoImage
|
63
|
-
logger.info format('Generating ISO image for %s', name)
|
64
71
|
bootdisk_generate_iso_image
|
65
72
|
rescue StandardError => e
|
66
73
|
failure format(_('Failed to generate ISO image for instance %{name}: %{message}'), name: name, message: e.message), e
|
@@ -21,12 +21,21 @@ class Setting
|
|
21
21
|
set('bootdisk_generic_efi_host_template', N_('Grub2 template to use for generic EFI host boot disks'),
|
22
22
|
'Boot disk Grub2 EFI - generic host', N_('Generic Grub2 EFI image template'), nil, collection: templates),
|
23
23
|
set('bootdisk_mkiso_command', N_('Command to generate ISO image, use genisoimage or mkisofs'), 'genisoimage', N_('ISO generation command')),
|
24
|
-
set('bootdisk_cache_media', N_('Installation media files will be cached for full host images'), true, N_('Installation media caching'))
|
24
|
+
set('bootdisk_cache_media', N_('Installation media files will be cached for full host images'), true, N_('Installation media caching')),
|
25
|
+
set('bootdisk_allowed_types', N_('List of allowed bootdisk types, remove type to disable it'), Setting::Bootdisk.bootdisk_types, N_('Allowed bootdisk types'))
|
25
26
|
]
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.humanized_category
|
29
30
|
N_('Boot disk')
|
30
31
|
end
|
32
|
+
|
33
|
+
def self.bootdisk_types
|
34
|
+
%w(generic host full_host subnet)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.allowed_types
|
38
|
+
Setting['bootdisk_allowed_types']
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
@@ -10,6 +10,8 @@ require 'uri'
|
|
10
10
|
# requires syslinux, ipxe/ipxe-bootimgs, genisoimage, isohybrid
|
11
11
|
module ForemanBootdisk
|
12
12
|
class ISOGenerator
|
13
|
+
extend Foreman::HTTPProxy
|
14
|
+
|
13
15
|
def self.generate_full_host(host, opts = {}, &block)
|
14
16
|
raise Foreman::Exception.new(N_('Host is not in build mode, so the template cannot be rendered')) unless host.build?
|
15
17
|
|
@@ -83,8 +85,8 @@ module ForemanBootdisk
|
|
83
85
|
EOT
|
84
86
|
end
|
85
87
|
|
86
|
-
#
|
87
|
-
wd = Dir.mktmpdir('bootdisk-iso-')
|
88
|
+
# And create new temporary directory:
|
89
|
+
wd = Dir.mktmpdir('bootdisk-iso-', Rails.root.join('tmp'))
|
88
90
|
Dir.mkdir(File.join(wd, 'build'))
|
89
91
|
|
90
92
|
if opts[:isolinux]
|
@@ -132,8 +134,8 @@ module ForemanBootdisk
|
|
132
134
|
File.join(Setting[:bootdisk_grub2_dir], 'grubx64.efi').to_s => 'GRUBX64.EFI',
|
133
135
|
File.join(Setting[:bootdisk_grub2_dir], 'shimx64.efi').to_s => 'BOOTX64.EFI',
|
134
136
|
}.each do |src, dest|
|
135
|
-
raise(Foreman::Exception.new(N_('Ensure %{
|
136
|
-
raise(Foreman::Exception.new(N_('Unable to mcopy %{
|
137
|
+
raise(Foreman::Exception.new(N_('Ensure %{file} is readable (or update "Grub2 directory" setting)'), file: src)) unless File.exist?(src)
|
138
|
+
raise(Foreman::Exception.new(N_('Unable to mcopy %{file}'), file: src)) unless system("mcopy -m -i #{efibootimg} '#{src}' '#{"::/EFI/BOOT/#{dest}"}'")
|
137
139
|
end
|
138
140
|
mkiso_args = "-eltorito-alt-boot -e efiboot.img -no-emul-boot"
|
139
141
|
isohybrod_args = ["--uefi"]
|
@@ -161,6 +163,15 @@ module ForemanBootdisk
|
|
161
163
|
raise Foreman::Exception.new(N_('ISO hybrid conversion failed: %s'), $?) unless system(*["isohybrid", isohybrod_args, iso].flatten.compact)
|
162
164
|
|
163
165
|
yield iso
|
166
|
+
ensure
|
167
|
+
# Clean the working directory (not the ISO file itself)
|
168
|
+
FileUtils.rm_f(File.join(wd, 'build'))
|
169
|
+
# Temporary directory cannot be cleaned in-process due to asynchronous send_file call.
|
170
|
+
# Also we cannot rely on systemd-tmpfiles-clean as private temporary files are not subject
|
171
|
+
# of scheduled cleanups. Let's clean bootdisks from prevous requests manually by finding
|
172
|
+
# and deleting all directories created 30 minutes ago.
|
173
|
+
delete_older_than = Time.now.to_i - (60 * 30)
|
174
|
+
Rails.root.glob('tmp/bootdisk-iso-*').select { |f| File.ctime(f) < delete_older_than }.each { |f| FileUtils.rm_f(f) }
|
164
175
|
end
|
165
176
|
|
166
177
|
def self.build_mkiso_command(output_file:, source_directory:, extra_commands:)
|
@@ -200,7 +211,14 @@ module ForemanBootdisk
|
|
200
211
|
ForemanBootdisk.logger.info("Fetching #{uri}")
|
201
212
|
write_cache = use_cache
|
202
213
|
uri = URI(uri)
|
203
|
-
|
214
|
+
|
215
|
+
if proxy_http_request?(nil, uri.host, uri.scheme)
|
216
|
+
proxy_uri = URI.parse(http_proxy)
|
217
|
+
http_object = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
|
218
|
+
else
|
219
|
+
http_object = Net::HTTP
|
220
|
+
end
|
221
|
+
http_object.start(uri.host, uri.port) do |http|
|
204
222
|
request = Net::HTTP::Get.new(uri.request_uri, 'Accept-Encoding' => 'plain')
|
205
223
|
|
206
224
|
http.request(request) do |response|
|
@@ -44,6 +44,10 @@ net_bootp
|
|
44
44
|
net_ls_addr
|
45
45
|
net_ls_routes
|
46
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.
|
47
51
|
sleep 5
|
48
52
|
set root=(<%= proxy_proto %>,<%= proxy_httpboot_host %>:<%= proxy_port %>)
|
49
53
|
# The variable will not survive configfile fetch, therefore absolute path
|
@@ -58,6 +58,13 @@ set dns <%= dns %>
|
|
58
58
|
set domain <%= interface.domain.to_s %>
|
59
59
|
<% end %>
|
60
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
|
+
|
61
68
|
# Chainload from Foreman rather than embedding OS info here, so the behaviour
|
62
69
|
# is entirely dynamic.
|
63
70
|
chain <%= bootdisk_chain_url %>
|
@@ -51,6 +51,9 @@ module ForemanBootdisk
|
|
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
|
data/lib/tasks/bootdisk.rake
CHANGED
@@ -88,23 +88,5 @@ end
|
|
88
88
|
|
89
89
|
Rake::Task[:test].enhance ['test:foreman_bootdisk']
|
90
90
|
|
91
|
-
namespace :foreman_bootdisk do
|
92
|
-
task :rubocop do
|
93
|
-
begin
|
94
|
-
require 'rubocop/rake_task'
|
95
|
-
RuboCop::RakeTask.new(:rubocop_foreman_bootdisk) do |task|
|
96
|
-
task.patterns = ["#{ForemanBootdisk::Engine.root}/app/**/*.rb",
|
97
|
-
"#{ForemanBootdisk::Engine.root}/lib/**/*.rb",
|
98
|
-
"#{ForemanBootdisk::Engine.root}/test/**/*.rb"]
|
99
|
-
task.options << '--auto-correct' if ENV['RUBOCOP_AUTOCORRECT']
|
100
|
-
end
|
101
|
-
rescue StandardError
|
102
|
-
puts 'Rubocop not loaded.'
|
103
|
-
end
|
104
|
-
|
105
|
-
Rake::Task['rubocop_foreman_bootdisk'].invoke
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
91
|
load 'tasks/jenkins.rake'
|
110
|
-
Rake::Task['jenkins:unit'].enhance ['test:foreman_bootdisk'
|
92
|
+
Rake::Task['jenkins:unit'].enhance ['test:foreman_bootdisk'] if Rake::Task.task_defined?(:'jenkins:unit')
|
data/locale/action_names.rb
CHANGED
metadata
CHANGED
@@ -1,59 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_bootdisk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 17.0
|
4
|
+
version: 17.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominic Cleal
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: rubocop
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rubocop-minitest
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rubocop-performance
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop-rails
|
14
|
+
name: theforeman-rubocop
|
57
15
|
requirement: !ruby/object:Gem::Requirement
|
58
16
|
requirements:
|
59
17
|
- - ">="
|
@@ -90,12 +48,14 @@ extra_rdoc_files:
|
|
90
48
|
- LICENSE
|
91
49
|
- README.md
|
92
50
|
files:
|
51
|
+
- ".github/workflows/rubocop.yaml"
|
93
52
|
- ".tx/config"
|
94
53
|
- AUTHORS
|
95
54
|
- CHANGES.md
|
96
55
|
- LICENSE
|
97
56
|
- README.md
|
98
57
|
- app/assets/javascripts/foreman_bootdisk/host_edit.js
|
58
|
+
- app/controllers/concerns/allowed_actions.rb
|
99
59
|
- app/controllers/foreman_bootdisk/api/v2/disks_controller.rb
|
100
60
|
- app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb
|
101
61
|
- app/controllers/foreman_bootdisk/disks_controller.rb
|
@@ -180,7 +140,7 @@ homepage: http://github.com/theforeman/foreman_bootdisk
|
|
180
140
|
licenses:
|
181
141
|
- GPL-3.0
|
182
142
|
metadata: {}
|
183
|
-
post_install_message:
|
143
|
+
post_install_message:
|
184
144
|
rdoc_options: []
|
185
145
|
require_paths:
|
186
146
|
- lib
|
@@ -188,15 +148,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
148
|
requirements:
|
189
149
|
- - ">="
|
190
150
|
- !ruby/object:Gem::Version
|
191
|
-
version: '
|
151
|
+
version: '2.5'
|
192
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
153
|
requirements:
|
194
154
|
- - ">="
|
195
155
|
- !ruby/object:Gem::Version
|
196
156
|
version: '0'
|
197
157
|
requirements: []
|
198
|
-
rubygems_version: 3.
|
199
|
-
signing_key:
|
158
|
+
rubygems_version: 3.1.4
|
159
|
+
signing_key:
|
200
160
|
specification_version: 4
|
201
161
|
summary: Create boot disks to provision hosts with Foreman
|
202
162
|
test_files: []
|