foreman_bootdisk 10.0.2 → 11.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +3 -4
- data/README.md +1 -0
- data/app/controllers/concerns/foreman_bootdisk/unattended_controller_ext.rb +2 -8
- data/app/controllers/foreman_bootdisk/disks_controller.rb +3 -3
- data/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb +2 -8
- data/app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb +4 -11
- data/app/models/concerns/foreman_bootdisk/host_ext.rb +4 -11
- data/app/models/setting/bootdisk.rb +1 -1
- data/db/migrate/20130914211030_create_host_bootdisk_template.rb +1 -1
- data/db/migrate/20130915104500_edit_host_bootdisk_template_multinic.rb +1 -1
- data/db/migrate/20130915133321_create_kickstart_bootdisk_template.rb +1 -1
- data/db/migrate/20130915201457_create_generic_host_bootdisk_template.rb +1 -1
- data/db/migrate/20131021095100_edit_host_bootdisk_template_dns_secondary.rb +1 -1
- data/db/migrate/20140522185700_change_templatekind_to_bootdisk.rb +2 -2
- data/db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb +1 -1
- data/lib/foreman_bootdisk/engine.rb +5 -5
- data/lib/foreman_bootdisk/version.rb +1 -1
- data/test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb +3 -3
- data/test/functional/foreman_bootdisk/api/v2/subnet_disks_controller_test.rb +1 -1
- data/test/functional/foreman_bootdisk/disks_controller_test.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7090fb0dd77db85fc9aa172b0a785f2d97c37a3dc5597a689a5c79fd7fbd0f2a
|
4
|
+
data.tar.gz: d35862a0f641367cc7bfd1fa95a801e0ab5afd056b19995fa6f05aae97bf4bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7c3a1e1f5e951b2252087d2064c9886a779a08c96a4c52d15c5d7711a542d5c9195e96bd86aecf2d82f780b633f11680c91368304d7874e8130b181e0f1606f
|
7
|
+
data.tar.gz: 278854b3bcfbd844c72d0c817e1479d47a47125f95f47cb2b08b7dc257f0ece53f73070296681952c7bfeced060329e30033bf021a371420727b3b942461fb92
|
data/CHANGES.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## v11.0.0
|
4
4
|
* bootdisk_raise template marco works in preview mode (#22136)
|
5
5
|
* host image works with subnet without gateway (#21106)
|
6
|
-
|
7
|
-
## v10.0.1
|
8
6
|
* Fix rake tasks are Taxonomy and User aware (#21877)
|
9
|
-
*
|
7
|
+
* database migrations support rails 5 (#21821)
|
8
|
+
* changes to support rails 5.1
|
10
9
|
|
11
10
|
## v10.0.0
|
12
11
|
* retry vmware iso boot 10 times before giving up (#19013)
|
data/README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
module ForemanBootdisk::UnattendedControllerExt
|
2
|
-
|
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
|
2
|
+
def find_host_by_ip_or_mac
|
9
3
|
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?
|
10
|
-
|
4
|
+
super
|
11
5
|
end
|
12
6
|
end
|
@@ -9,7 +9,7 @@ module ForemanBootdisk
|
|
9
9
|
tmpl = ForemanBootdisk::Renderer.new.generic_template_render
|
10
10
|
rescue => e
|
11
11
|
error_rendering(e)
|
12
|
-
|
12
|
+
redirect_back(fallback_location: '/')
|
13
13
|
return
|
14
14
|
end
|
15
15
|
|
@@ -24,7 +24,7 @@ module ForemanBootdisk
|
|
24
24
|
tmpl = host.bootdisk_template_render
|
25
25
|
rescue => e
|
26
26
|
error_rendering(e)
|
27
|
-
|
27
|
+
redirect_back(fallback_location: '/')
|
28
28
|
return
|
29
29
|
end
|
30
30
|
|
@@ -48,7 +48,7 @@ module ForemanBootdisk
|
|
48
48
|
tmpl = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
|
49
49
|
rescue => e
|
50
50
|
error_rendering(e)
|
51
|
-
|
51
|
+
redirect_back(fallback_location: '/')
|
52
52
|
return
|
53
53
|
end
|
54
54
|
|
@@ -1,11 +1,5 @@
|
|
1
1
|
module ForemanBootdisk::HostsHelperExt
|
2
|
-
|
3
|
-
|
4
|
-
included do
|
5
|
-
alias_method_chain :host_title_actions, :bootdisk
|
6
|
-
end
|
7
|
-
|
8
|
-
def host_title_actions_with_bootdisk(*args)
|
2
|
+
def host_title_actions(*args)
|
9
3
|
if @host.bootdisk_downloadable?
|
10
4
|
title_actions(
|
11
5
|
button_group(
|
@@ -24,7 +18,7 @@ module ForemanBootdisk::HostsHelperExt
|
|
24
18
|
bootdisk_button_disabled
|
25
19
|
end
|
26
20
|
|
27
|
-
|
21
|
+
super
|
28
22
|
end
|
29
23
|
|
30
24
|
def bootdisk_button_disabled
|
@@ -1,19 +1,12 @@
|
|
1
1
|
module ForemanBootdisk
|
2
2
|
module ComputeResources
|
3
3
|
module Vmware
|
4
|
-
|
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]
|
4
|
+
def capabilities
|
5
|
+
super + [:bootdisk]
|
13
6
|
end
|
14
7
|
|
15
|
-
def
|
16
|
-
args =
|
8
|
+
def parse_args(args = {})
|
9
|
+
args = super
|
17
10
|
if args[:provision_method] == 'bootdisk'
|
18
11
|
args[:cdroms] = [new_cdrom]
|
19
12
|
args[:boot_order] = ['cdrom', 'disk']
|
@@ -1,13 +1,6 @@
|
|
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
|
-
|
11
4
|
def bootdisk_template
|
12
5
|
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'))
|
13
6
|
end
|
@@ -37,11 +30,11 @@ module ForemanBootdisk::HostExt
|
|
37
30
|
/i.86|x86[_-]64/ =~ architecture.name
|
38
31
|
end
|
39
32
|
|
40
|
-
def
|
41
|
-
|
33
|
+
def validate_media?
|
34
|
+
super || (managed && bootdisk_build? && build?)
|
42
35
|
end
|
43
36
|
|
44
|
-
def
|
45
|
-
|
37
|
+
def can_be_built?
|
38
|
+
super || (managed? and SETTINGS[:unattended] and bootdisk_build? and !build?)
|
46
39
|
end
|
47
40
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Setting::Bootdisk< ::Setting
|
2
2
|
def self.load_defaults
|
3
|
-
return unless
|
3
|
+
return unless ApplicationRecord.connection.table_exists?('settings')
|
4
4
|
return unless super
|
5
5
|
|
6
6
|
ipxe = ['/usr/lib/ipxe'].find { |p| File.exist?(p) } || '/usr/share/ipxe'
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class ChangeTemplatekindToBootdisk < ActiveRecord::Migration
|
2
|
-
class FakeConfigTemplate <
|
1
|
+
class ChangeTemplatekindToBootdisk < ActiveRecord::Migration[4.2]
|
2
|
+
class FakeConfigTemplate < ApplicationRecord
|
3
3
|
if ActiveRecord::Migrator.get_all_versions.include?(20150514072626)
|
4
4
|
self.table_name = 'templates'
|
5
5
|
else
|
@@ -48,7 +48,7 @@ module ForemanBootdisk
|
|
48
48
|
|
49
49
|
initializer 'foreman_bootdisk.register_plugin', :before => :finisher_hook do |app|
|
50
50
|
Foreman::Plugin.register :foreman_bootdisk do
|
51
|
-
requires_foreman '>= 1.
|
51
|
+
requires_foreman '>= 1.17'
|
52
52
|
|
53
53
|
security_block :bootdisk do |map|
|
54
54
|
permission :download_bootdisk, {:'foreman_bootdisk/disks' => [:generic, :host, :full_host, :subnet, :help],
|
@@ -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(:prepend, 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(:prepend, ForemanBootdisk::HostsHelperExt)
|
82
|
+
UnattendedController.send(:prepend, ForemanBootdisk::UnattendedControllerExt)
|
83
|
+
Foreman::Model::Vmware.send(:prepend, 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
|
@@ -7,7 +7,7 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
|
|
7
7
|
test "should generate generic image" do
|
8
8
|
ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
|
9
9
|
@controller.expects(:read_file).with("temp ISO").returns("ISO image")
|
10
|
-
get :generic
|
10
|
+
get :generic
|
11
11
|
assert_response :success
|
12
12
|
assert_equal "ISO image", @response.body
|
13
13
|
end
|
@@ -19,7 +19,7 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
|
|
19
19
|
test "should generate host image" do
|
20
20
|
ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk host template/))).yields("temp ISO")
|
21
21
|
@controller.expects(:read_file).with("temp ISO").returns("ISO image")
|
22
|
-
get :host, {:id => @host.name}
|
22
|
+
get :host, params: {:id => @host.name}
|
23
23
|
assert_response :success
|
24
24
|
assert_equal "ISO image", @response.body
|
25
25
|
end
|
@@ -27,7 +27,7 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
|
|
27
27
|
test "should generate full host image" do
|
28
28
|
ForemanBootdisk::ISOGenerator.expects(:generate_full_host).with(@host).yields("temp ISO")
|
29
29
|
@controller.expects(:read_file).with("temp ISO").returns("ISO image")
|
30
|
-
get :host, {:id => @host.name, :full => true}
|
30
|
+
get :host, params: {:id => @host.name, :full => true}
|
31
31
|
assert_response :success
|
32
32
|
assert_equal "ISO image", @response.body
|
33
33
|
end
|
@@ -14,7 +14,7 @@ class ForemanBootdisk::Api::V2::SubnetDisksControllerTest < ActionController::Te
|
|
14
14
|
ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
|
15
15
|
ForemanBootdisk::Renderer.any_instance.stubs(:bootdisk_chain_url).yields("http://smart-proxy.lan")
|
16
16
|
File.expects(:read).with("temp ISO").returns("ISO image")
|
17
|
-
get :subnet, {:id => @host.subnet.id}
|
17
|
+
get :subnet, params: {:id => @host.subnet.id}
|
18
18
|
assert_response :success
|
19
19
|
assert_equal "ISO image", @response.body
|
20
20
|
end
|
@@ -7,7 +7,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
|
|
7
7
|
test "should generate generic image" do
|
8
8
|
ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
|
9
9
|
@controller.expects(:read_file).with("temp ISO").returns("ISO image")
|
10
|
-
get :generic,
|
10
|
+
get :generic, session: set_session_user
|
11
11
|
assert_response :success
|
12
12
|
assert_equal "ISO image", @response.body
|
13
13
|
end
|
@@ -21,7 +21,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
|
|
21
21
|
test "should generate host image" do
|
22
22
|
ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk host template/))).yields("temp ISO")
|
23
23
|
@controller.expects(:read_file).with("temp ISO").returns("ISO image")
|
24
|
-
get :host, {:id => @host.name}, set_session_user
|
24
|
+
get :host, params: {:id => @host.name}, session: set_session_user
|
25
25
|
assert_response :success
|
26
26
|
assert_equal "ISO image", @response.body
|
27
27
|
end
|
@@ -29,7 +29,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
|
|
29
29
|
test "should generate full host image" do
|
30
30
|
ForemanBootdisk::ISOGenerator.expects(:generate_full_host).with(@host).yields("temp ISO")
|
31
31
|
@controller.expects(:read_file).with("temp ISO").returns("ISO image")
|
32
|
-
get :full_host, {:id => @host.name}, set_session_user
|
32
|
+
get :full_host, params: {:id => @host.name}, session: set_session_user
|
33
33
|
assert_response :success
|
34
34
|
assert_equal "ISO image", @response.body
|
35
35
|
end
|
@@ -38,7 +38,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
|
|
38
38
|
ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
|
39
39
|
ForemanBootdisk::Renderer.any_instance.stubs(:bootdisk_chain_url).yields("http://smart-proxy.lan")
|
40
40
|
@controller.expects(:read_file).with("temp ISO").returns("ISO image")
|
41
|
-
get :subnet, {:id => @host.name}, set_session_user
|
41
|
+
get :subnet, params: {:id => @host.name}, session: set_session_user
|
42
42
|
assert_empty flash[:error]
|
43
43
|
assert_response :success
|
44
44
|
assert_equal "ISO image", @response.body
|
@@ -52,14 +52,14 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
|
|
52
52
|
setup :setup_host
|
53
53
|
|
54
54
|
test "should not generate subnet image" do
|
55
|
-
get :subnet, {:id => @host.name}, set_session_user
|
55
|
+
get :subnet, params: {:id => @host.name}, session: set_session_user
|
56
56
|
assert_match(/Failed.*: TFTP feature not enabled/, flash[:error])
|
57
57
|
assert_response :redirect
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
test "should render help" do
|
62
|
-
get :help,
|
62
|
+
get :help, session: set_session_user
|
63
63
|
assert_response :success
|
64
64
|
end
|
65
65
|
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:
|
4
|
+
version: 11.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: 2018-01-
|
11
|
+
date: 2018-01-15 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.
|