foreman_bootdisk 10.0.0 → 10.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/app/controllers/concerns/foreman_bootdisk/unattended_controller_ext.rb +8 -2
- data/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb +8 -2
- data/app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb +11 -4
- data/app/models/concerns/foreman_bootdisk/host_ext.rb +12 -5
- data/app/services/foreman_bootdisk/renderer.rb +1 -1
- data/lib/foreman_bootdisk/engine.rb +4 -4
- data/lib/foreman_bootdisk/version.rb +1 -1
- data/lib/tasks/bootdisk.rake +31 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 650c3fef3d65bf931b5b55742b6edf13ab569b85
|
4
|
+
data.tar.gz: 5ba2e8581df468982cea40b986fbfe2e659b2832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6281f104fa4b4bd26517485a3c597fb428ddbfb6900e15116b9ecf69f488c1f1e46cc95261829afcd7031ad4d6cc169760c315a7a2b1097d63706dc5b5bd0e46
|
7
|
+
data.tar.gz: 29bfcedcadee57b04a791c064ebe1fa56327f0cdd54ec96578b2eacd899540dc737472dadea02a4aa34aa8582aef5a26bec7722a8a169864eb4e84eda4a7ddda
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v10.0.1
|
4
|
+
* Fix rake tasks are Taxonomy and User aware (#21877)
|
5
|
+
* Revert alias_method_chain with Module#prepend for Katello 3.4 compatibility
|
6
|
+
|
3
7
|
## v10.0.0
|
4
8
|
* retry vmware iso boot 10 times before giving up (#19013)
|
5
9
|
* fix duplicate template creation during database seeding (#19733)
|
@@ -1,6 +1,12 @@
|
|
1
1
|
module ForemanBootdisk::UnattendedControllerExt
|
2
|
-
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
alias_method_chain :find_host_by_ip_or_mac, :param_mac
|
6
|
+
end
|
7
|
+
|
8
|
+
def find_host_by_ip_or_mac_with_param_mac
|
3
9
|
request.env['HTTP_X_RHN_PROVISIONING_MAC_0'] = "unknown #{params['mac']}" unless request.env.has_key?('HTTP_X_RHN_PROVISIONING_MAC_0') || params['mac'].nil?
|
4
|
-
|
10
|
+
find_host_by_ip_or_mac_without_param_mac
|
5
11
|
end
|
6
12
|
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module ForemanBootdisk::HostsHelperExt
|
2
|
-
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
alias_method_chain :host_title_actions, :bootdisk
|
6
|
+
end
|
7
|
+
|
8
|
+
def host_title_actions_with_bootdisk(*args)
|
3
9
|
if @host.bootdisk_downloadable?
|
4
10
|
title_actions(
|
5
11
|
button_group(
|
@@ -18,7 +24,7 @@ module ForemanBootdisk::HostsHelperExt
|
|
18
24
|
bootdisk_button_disabled
|
19
25
|
end
|
20
26
|
|
21
|
-
|
27
|
+
host_title_actions_without_bootdisk(*args)
|
22
28
|
end
|
23
29
|
|
24
30
|
def bootdisk_button_disabled
|
@@ -1,12 +1,19 @@
|
|
1
1
|
module ForemanBootdisk
|
2
2
|
module ComputeResources
|
3
3
|
module Vmware
|
4
|
-
|
5
|
-
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
alias_method_chain :capabilities, :bootdisk
|
8
|
+
alias_method_chain :parse_args, :bootdisk
|
9
|
+
end
|
10
|
+
|
11
|
+
def capabilities_with_bootdisk
|
12
|
+
capabilities_without_bootdisk + [:bootdisk]
|
6
13
|
end
|
7
14
|
|
8
|
-
def
|
9
|
-
args =
|
15
|
+
def parse_args_with_bootdisk(args = {})
|
16
|
+
args = parse_args_without_bootdisk args
|
10
17
|
if args[:provision_method] == 'bootdisk'
|
11
18
|
args[:cdroms] = [new_cdrom]
|
12
19
|
args[:boot_order] = ['cdrom', 'disk']
|
@@ -1,8 +1,15 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
3
|
module ForemanBootdisk::HostExt
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
alias_method_chain :validate_media?, :bootdisk
|
8
|
+
alias_method_chain :can_be_built?, :bootdisk
|
9
|
+
end
|
10
|
+
|
4
11
|
def bootdisk_template
|
5
|
-
ProvisioningTemplate.find_by_name(Setting[:bootdisk_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_host_template'))
|
12
|
+
ProvisioningTemplate.unscoped.find_by_name(Setting[:bootdisk_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_host_template'))
|
6
13
|
end
|
7
14
|
|
8
15
|
def bootdisk_template_render
|
@@ -34,11 +41,11 @@ module ForemanBootdisk::HostExt
|
|
34
41
|
/i.86|x86[_-]64/ =~ architecture.name
|
35
42
|
end
|
36
43
|
|
37
|
-
def
|
38
|
-
|
44
|
+
def validate_media_with_bootdisk?
|
45
|
+
validate_media_without_bootdisk? || (managed && bootdisk_build? && build?)
|
39
46
|
end
|
40
47
|
|
41
|
-
def
|
42
|
-
|
48
|
+
def can_be_built_with_bootdisk?
|
49
|
+
can_be_built_without_bootdisk? || (managed? and SETTINGS[:unattended] and bootdisk_build? and !build?)
|
43
50
|
end
|
44
51
|
end
|
@@ -8,7 +8,7 @@ module ForemanBootdisk
|
|
8
8
|
include RendererMethods
|
9
9
|
|
10
10
|
def generic_template_render(subnet = nil)
|
11
|
-
tmpl = ProvisioningTemplate.find_by_name(Setting[:bootdisk_generic_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_generic_host_template'))
|
11
|
+
tmpl = ProvisioningTemplate.unscoped.find_by_name(Setting[:bootdisk_generic_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_generic_host_template'))
|
12
12
|
|
13
13
|
if subnet.present?
|
14
14
|
# rendering a subnet-level bootdisk requires tricking the renderer into thinking it has a
|
@@ -76,11 +76,11 @@ module ForemanBootdisk
|
|
76
76
|
|
77
77
|
config.to_prepare do
|
78
78
|
begin
|
79
|
-
Host::Managed.send(:
|
79
|
+
Host::Managed.send(:include, ForemanBootdisk::HostExt)
|
80
80
|
Host::Managed.send(:include, ForemanBootdisk::Orchestration::Compute) if SETTINGS[:unattended]
|
81
|
-
HostsHelper.send(:
|
82
|
-
UnattendedController.send(:
|
83
|
-
Foreman::Model::Vmware.send(:
|
81
|
+
HostsHelper.send(:include, ForemanBootdisk::HostsHelperExt)
|
82
|
+
UnattendedController.send(:include, ForemanBootdisk::UnattendedControllerExt)
|
83
|
+
Foreman::Model::Vmware.send(:include, ForemanBootdisk::ComputeResources::Vmware) if Foreman::Model::Vmware.available?
|
84
84
|
rescue => e
|
85
85
|
puts "#{ForemanBootdisk::ENGINE_NAME}: skipping engine hook (#{e.to_s})"
|
86
86
|
end
|
data/lib/tasks/bootdisk.rake
CHANGED
@@ -16,46 +16,54 @@ namespace :bootdisk do
|
|
16
16
|
namespace :generate do
|
17
17
|
desc 'Generate a static boot disk for a specific host. NAME=fqdn, OUTPUT path'
|
18
18
|
task :host => :environment do
|
19
|
-
|
20
|
-
|
19
|
+
User.as_anonymous_admin do
|
20
|
+
host = Host::Base.unscoped.find_by_name(ENV['NAME']) || raise("cannot find host '#{ENV['NAME']}', specify NAME=fqdn")
|
21
|
+
tmpl = host.bootdisk_template_render
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
ForemanBootdisk::ISOGenerator.generate(:ipxe => tmpl, :dir => outputdir) do |image|
|
24
|
+
output = ENV['OUTPUT'] || File.join(outputdir, "#{host.name}.iso")
|
25
|
+
FileUtils.mv image, output
|
26
|
+
puts "Wrote #{output}"
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
31
|
desc 'Generate a full boot disk for a specific host with the OS bootloader included. NAME=fqdn, OUTPUT path'
|
30
32
|
task :full_host => :environment do
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
User.as_anonymous_admin do
|
34
|
+
host = Host::Base.unscoped.find_by_name(ENV['NAME']) || raise("cannot find host '#{ENV['NAME']}', specify NAME=fqdn")
|
35
|
+
ForemanBootdisk::ISOGenerator.generate_full_host(host, :dir => outputdir) do |image|
|
36
|
+
output = ENV['OUTPUT'] || File.join(outputdir, "#{host.name}_#{Date.today.strftime('%Y%m%d')}.iso")
|
37
|
+
FileUtils.cp image, output
|
38
|
+
puts "Wrote #{output}"
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
43
|
desc 'Generate a generic boot disk. OUTPUT=path'
|
40
44
|
task :generic => :environment do
|
41
|
-
|
45
|
+
User.as_anonymous_admin do
|
46
|
+
tmpl = ForemanBootdisk::Renderer.new.generic_template_render
|
42
47
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
48
|
+
ForemanBootdisk::ISOGenerator.generate(:ipxe => tmpl, :dir => outputdir) do |image|
|
49
|
+
output = ENV['OUTPUT'] || File.join(outputdir, "bootdisk_#{URI.parse(Setting[:foreman_url]).host}.iso")
|
50
|
+
FileUtils.cp image, output
|
51
|
+
puts "Wrote #{output}"
|
52
|
+
end
|
47
53
|
end
|
48
54
|
end
|
49
55
|
|
50
56
|
desc 'Generate a subnet disk for a specific subnet. NAME=subnet, OUTPUT=path'
|
51
57
|
task :subnet => :environment do
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
58
|
+
User.as_anonymous_admin do
|
59
|
+
subnet = Subnet.unscoped.find_by_name(ENV['NAME']) || raise("cannot find subnet '#{ENV['NAME']}', specify NAME=subnet")
|
60
|
+
subnet.tftp || raise(::Foreman::Exception.new(N_("TFTP feature not enabled for subnet %s"), subnet.name))
|
61
|
+
tmpl = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
|
62
|
+
ForemanBootdisk::ISOGenerator.generate(:ipxe => tmpl, :dir => outputdir) do |image|
|
63
|
+
output = ENV['OUTPUT'] || File.join(outputdir, "bootdisk_subnet_#{subnet.name}.iso")
|
64
|
+
FileUtils.cp image, output
|
65
|
+
puts "Wrote #{output}"
|
66
|
+
end
|
59
67
|
end
|
60
68
|
end
|
61
69
|
end
|
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: 10.0.
|
4
|
+
version: 10.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominic Cleal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Plugin for Foreman that creates iPXE-based boot disks to provision hosts
|
14
14
|
without the need for PXE infrastructure.
|