foreman_bootdisk 12.0.1 → 16.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.
- checksums.yaml +4 -4
- data/AUTHORS +26 -0
- data/CHANGES.md +9 -0
- data/README.md +19 -0
- data/app/controllers/foreman_bootdisk/api/v2/disks_controller.rb +11 -9
- data/app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb +37 -31
- data/app/controllers/foreman_bootdisk/disks_controller.rb +24 -19
- data/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb +86 -45
- data/app/lib/foreman_bootdisk/scope/bootdisk.rb +23 -0
- data/app/lib/foreman_bootdisk/scope/full_host_bootdisk.rb +15 -0
- data/app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb +4 -2
- data/app/models/concerns/foreman_bootdisk/host_ext.rb +33 -22
- data/app/models/concerns/foreman_bootdisk/orchestration/compute.rb +14 -10
- data/app/models/setting/bootdisk.rb +21 -23
- data/app/services/foreman_bootdisk/iso_generator.rb +144 -104
- data/app/services/foreman_bootdisk/renderer.rb +40 -21
- data/app/views/foreman_bootdisk/generic_host.erb +21 -3
- data/app/views/foreman_bootdisk/generic_static_host.erb +34 -0
- data/app/views/foreman_bootdisk/host.erb +29 -14
- data/config/routes.rb +15 -13
- data/config/routes/mount_engine.rb +3 -1
- data/db/migrate/20130914211030_create_host_bootdisk_template.rb +4 -4
- data/db/migrate/20130915104500_edit_host_bootdisk_template_multinic.rb +4 -4
- data/db/migrate/20130915133321_create_kickstart_bootdisk_template.rb +4 -4
- data/db/migrate/20130915201457_create_generic_host_bootdisk_template.rb +4 -4
- data/db/migrate/20131021095100_edit_host_bootdisk_template_dns_secondary.rb +4 -4
- data/db/migrate/20140522185700_change_templatekind_to_bootdisk.rb +16 -14
- data/db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb +4 -2
- data/db/seeds.d/50-bootdisk_templates.rb +21 -36
- data/lib/foreman_bootdisk.rb +2 -0
- data/lib/foreman_bootdisk/engine.rb +25 -37
- data/lib/foreman_bootdisk/version.rb +3 -1
- data/lib/tasks/bootdisk.rake +34 -17
- data/locale/ca/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/ca/foreman_bootdisk.po +31 -15
- data/locale/de/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/de/foreman_bootdisk.po +40 -22
- data/locale/en/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/en/foreman_bootdisk.po +24 -9
- data/locale/en_GB/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/en_GB/foreman_bootdisk.po +31 -16
- data/locale/es/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/es/foreman_bootdisk.po +46 -31
- data/locale/foreman_bootdisk.pot +82 -54
- data/locale/fr/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/fr/foreman_bootdisk.po +30 -15
- data/locale/gemspec.rb +3 -1
- data/locale/it/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/it/foreman_bootdisk.po +27 -12
- data/locale/ja/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/ja/foreman_bootdisk.po +30 -15
- data/locale/ko/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/ko/foreman_bootdisk.po +27 -12
- data/locale/pt_BR/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/pt_BR/foreman_bootdisk.po +43 -27
- data/locale/ru/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/ru/foreman_bootdisk.po +28 -13
- data/locale/sv_SE/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/sv_SE/foreman_bootdisk.po +26 -11
- data/locale/zh_CN/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/zh_CN/foreman_bootdisk.po +46 -31
- data/locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo +0 -0
- data/locale/zh_TW/foreman_bootdisk.po +27 -12
- data/release-gem +84 -0
- data/test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb +35 -33
- data/test/functional/foreman_bootdisk/api/v2/subnet_disks_controller_test.rb +9 -7
- data/test/functional/foreman_bootdisk/disks_controller_test.rb +27 -25
- data/test/models/host/managed_test.rb +26 -0
- data/test/test_plugin_helper.rb +11 -7
- data/test/unit/access_permissions_test.rb +2 -0
- data/test/unit/concerns/compute_resources/vmware_test.rb +67 -63
- data/test/unit/concerns/host_test.rb +54 -46
- data/test/unit/concerns/orchestration/compute_test.rb +41 -39
- data/test/unit/foreman_bootdisk/renderer_test.rb +36 -0
- data/test/unit/foreman_bootdisk/scope/bootdisk_test.rb +31 -0
- data/test/unit/foreman_bootdisk/scope/full_host_bootdisk_test.rb +30 -0
- data/test/unit/iso_generator_test.rb +67 -40
- metadata +69 -5
- data/app/services/foreman_bootdisk/renderer_methods.rb +0 -27
|
@@ -1,65 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_plugin_helper'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
module ForemanBootdisk
|
|
6
|
+
class HostTest < ActiveSupport::TestCase
|
|
7
|
+
test '#bootdisk_build? must be true when provision_method is bootdisk' do
|
|
8
|
+
host = FactoryBot.build(:host, :managed)
|
|
9
|
+
host.provision_method = 'bootdisk'
|
|
10
|
+
assert host.bootdisk_build?
|
|
11
|
+
assert_not host.image_build?
|
|
12
|
+
assert_not host.pxe_build?
|
|
13
|
+
end
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
test '#validate_media? must be true when provision_method is bootdisk' do
|
|
16
|
+
host = FactoryBot.build(:host, :managed,
|
|
17
|
+
provision_method: 'bootdisk',
|
|
18
|
+
build: true)
|
|
19
|
+
assert host.validate_media?
|
|
20
|
+
end
|
|
18
21
|
|
|
22
|
+
test '#can_be_built? must be true when provision_method is bootdisk' do
|
|
23
|
+
host = FactoryBot.build(:host, :managed,
|
|
24
|
+
provision_method: 'bootdisk')
|
|
25
|
+
assert host.can_be_built?
|
|
26
|
+
end
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
test 'host should have bootdisk' do
|
|
29
|
+
if unattended?
|
|
30
|
+
h = FactoryBot.build(:host, :managed,
|
|
31
|
+
provision_method: 'bootdisk')
|
|
32
|
+
assert h.bootdisk?
|
|
33
|
+
end
|
|
26
34
|
end
|
|
27
|
-
end
|
|
28
35
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
test 'host should not have bootdisk' do
|
|
37
|
+
if unattended?
|
|
38
|
+
h = FactoryBot.create(:host)
|
|
39
|
+
assert_equal false, h.bootdisk?
|
|
40
|
+
end
|
|
33
41
|
end
|
|
34
|
-
end
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
context '#bootdisk_downloadable?' do
|
|
44
|
+
test 'should be true for 64 bit architecture' do
|
|
45
|
+
architecture = Architecture.where(name: 'x86_64').first
|
|
46
|
+
host = FactoryBot.build(:host, :managed, architecture: architecture)
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
assert host.bootdisk_downloadable?
|
|
49
|
+
end
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
test 'should be true for 32 bit architecture' do
|
|
52
|
+
architecture = FactoryBot.create(:architecture, name: 'i386')
|
|
53
|
+
host = FactoryBot.build(:host, :managed, architecture: architecture)
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
assert host.bootdisk_downloadable?
|
|
56
|
+
end
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
test 'should be false for non-intel architecture' do
|
|
59
|
+
architecture = Architecture.where(name: 's390').first
|
|
60
|
+
host = FactoryBot.build(:host, :managed, architecture: architecture)
|
|
54
61
|
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
assert_not host.bootdisk_downloadable?
|
|
63
|
+
end
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
test 'should be true if architecture is absent' do
|
|
66
|
+
host = FactoryBot.build(:host, :managed, architecture: nil)
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
assert_nil host.architecture
|
|
69
|
+
assert host.bootdisk_downloadable?
|
|
70
|
+
end
|
|
63
71
|
end
|
|
64
72
|
end
|
|
65
73
|
end
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_plugin_helper'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
module ForemanBootdisk
|
|
6
|
+
class OrchestrationComputeTest < ActiveSupport::TestCase
|
|
7
|
+
setup do
|
|
8
|
+
disable_orchestration
|
|
9
|
+
@cr = FactoryBot.build(:vmware_cr)
|
|
10
|
+
@host = FactoryBot.build(:host, :managed,
|
|
11
|
+
compute_resource: @cr,
|
|
12
|
+
provision_method: 'bootdisk')
|
|
13
|
+
end
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
test 'provisioning a host with provision method bootdisk should upload iso' do
|
|
16
|
+
@cr.expects(:iso_upload)
|
|
17
|
+
@host.send(:setIsoImage)
|
|
18
|
+
end
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
test 'provisioning a host with provision method bootdisk should attach iso' do
|
|
21
|
+
@cr.expects(:iso_attach)
|
|
22
|
+
@host.send(:setAttachIsoImage)
|
|
23
|
+
end
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
test 'provisioning a host with provision method bootdisk should queue bootdisk tasks' do
|
|
26
|
+
@host.stubs(:compute?).returns(true)
|
|
27
|
+
@host.send(:queue_bootdisk_compute)
|
|
28
|
+
tasks = @host.queue.all.map(&:name)
|
|
29
|
+
assert_includes tasks, "Generating ISO image for #{@host.name}"
|
|
30
|
+
assert_includes tasks, "Upload ISO image to datastore for #{@host.name}"
|
|
31
|
+
assert_includes tasks, "Attach ISO image to CDROM drive for #{@host.name}"
|
|
32
|
+
end
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
test 'should rebuild bootdisk' do
|
|
35
|
+
@host.expects(:bootdisk_generate_iso_image).returns(true)
|
|
36
|
+
@host.expects(:bootdisk_upload_iso).returns(true)
|
|
37
|
+
@host.expects(:bootdisk_attach_iso).returns(true)
|
|
38
|
+
assert @host.rebuild_with_bootdisk
|
|
39
|
+
end
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
test 'should skip rebuild bootdisk' do
|
|
42
|
+
host = FactoryBot.build(:host,
|
|
43
|
+
compute_resource: @cr)
|
|
44
|
+
host.expects(:bootdisk_generate_iso_image).never
|
|
45
|
+
host.expects(:bootdisk_upload_iso).never
|
|
46
|
+
host.expects(:bootdisk_attach_iso).never
|
|
47
|
+
assert host.rebuild_with_bootdisk
|
|
48
|
+
end
|
|
47
49
|
end
|
|
48
50
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_plugin_helper'
|
|
4
|
+
|
|
5
|
+
module ForemanBootdisk
|
|
6
|
+
class RendererTest < ActiveSupport::TestCase
|
|
7
|
+
include ForemanBootdiskTestHelper
|
|
8
|
+
|
|
9
|
+
setup do
|
|
10
|
+
User.current = users(:admin)
|
|
11
|
+
setup_bootdisk
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
let(:renderer) { ForemanBootdisk::Renderer.new }
|
|
15
|
+
|
|
16
|
+
describe 'a generic template' do
|
|
17
|
+
test 'can be rendered' do
|
|
18
|
+
rendered_template = renderer.generic_template_render
|
|
19
|
+
assert_includes rendered_template, 'ifstat'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
test 'does not include a host token' do
|
|
23
|
+
rendered_template = renderer.generic_template_render
|
|
24
|
+
assert_includes rendered_template, 'http://foreman.some.host.fqdn/unattended/iPXE?mac=${net0/mac}'
|
|
25
|
+
assert_not_includes rendered_template, 'token'
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context 'with a subnet' do
|
|
30
|
+
let(:subnet) { FactoryBot.create(:subnet_ipv4) }
|
|
31
|
+
test 'renders a subnet template' do
|
|
32
|
+
assert_includes renderer.generic_template_render(subnet), 'ifstat'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_plugin_helper'
|
|
4
|
+
|
|
5
|
+
module ForemanBootdisk
|
|
6
|
+
module Scope
|
|
7
|
+
class BootdiskTest < ActiveSupport::TestCase
|
|
8
|
+
let(:host) { FactoryBot.build(:host, :managed) }
|
|
9
|
+
let(:source) { Foreman::Renderer::Source::String.new(content: 'Test') }
|
|
10
|
+
let(:scope) { ForemanBootdisk::Scope::Bootdisk.new(host: host, source: source) }
|
|
11
|
+
|
|
12
|
+
describe '#bootdisk_chain_url' do
|
|
13
|
+
test 'should render bootdisk chain url' do
|
|
14
|
+
assert_equal "http://foreman.some.host.fqdn/unattended/iPXE?mac=#{URI.encode_www_form_component(host.mac)}", scope.bootdisk_chain_url
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
test 'should render bootdisk chain url with custom mac' do
|
|
18
|
+
assert_equal 'http://foreman.some.host.fqdn/unattended/iPXE?mac=00%3A11%3A22%3A33%3A44%3A55', scope.bootdisk_chain_url('00:11:22:33:44:55')
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe '#bootdisk_raise' do
|
|
23
|
+
test 'should raise a Foreman::Exception' do
|
|
24
|
+
assert_raise ::Foreman::Exception do
|
|
25
|
+
scope.bootdisk_raise('Some error.')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_plugin_helper'
|
|
4
|
+
|
|
5
|
+
module ForemanBootdisk
|
|
6
|
+
module Scope
|
|
7
|
+
class BootdiskTest < ActiveSupport::TestCase
|
|
8
|
+
let(:operatingsystem) { FactoryBot.create(:ubuntu14_10, :with_media, :with_archs) }
|
|
9
|
+
let(:host) { FactoryBot.build(:host, :managed, operatingsystem: operatingsystem) }
|
|
10
|
+
let(:source) { Foreman::Renderer::Source::String.new(content: 'Test') }
|
|
11
|
+
let(:scope) { ForemanBootdisk::Scope::FullHostBootdisk.new(host: host, source: source) }
|
|
12
|
+
|
|
13
|
+
setup do
|
|
14
|
+
MediumProviders::Default.any_instance.stubs(:unique_id).returns('MyMedium01-ZYHBD6OPET')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '@kernel' do
|
|
18
|
+
test 'should match filename on bootdisk' do
|
|
19
|
+
assert_equal 'BOOT/MYMEDIUM01_ZYHBD6OPET_LINUX', scope.instance_variable_get('@kernel')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe '@initrd' do
|
|
24
|
+
test 'should match filename on bootdisk' do
|
|
25
|
+
assert_equal 'BOOT/EDIUM01_ZYHBD6OPET_INITRD_GZ', scope.instance_variable_get('@initrd')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,48 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_plugin_helper'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
setup :setup_subnet
|
|
8
|
-
setup :setup_host
|
|
5
|
+
module ForemanBootdisk
|
|
6
|
+
class IsoGeneratorTest < ActiveSupport::TestCase
|
|
7
|
+
include ForemanBootdiskTestHelper
|
|
8
|
+
setup :setup_bootdisk
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
describe '#generate_full_host' do
|
|
11
|
+
let(:medium) { FactoryBot.create(:medium, name: 'Red Hat Enterprise Linux Atomic Mirror') }
|
|
12
|
+
let(:operatingsystem) { FactoryBot.create(:ubuntu14_10, :with_archs, :with_ptables, media: [medium]) }
|
|
13
|
+
let(:host) { FactoryBot.create(:host, :managed, operatingsystem: operatingsystem, build: true) }
|
|
14
|
+
let(:template) { FactoryBot.create(:provisioning_template, template: 'Fake kernel line <%= @kernel %> - <%= @initrd %>') }
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{:"boot/Debian-8.1-x86_64"=>"/tmp/pxeboot/vmlinuz"},
|
|
18
|
-
{:"boot/Debian-8.1-x86_64"=>"/tmp/pxeboot/initrd.img"}
|
|
19
|
-
]
|
|
20
|
-
@host.operatingsystem.expects(:pxe_files).returns(boot_files)
|
|
21
|
-
ForemanBootdisk::ISOGenerator.expects(:generate).with({
|
|
22
|
-
:isolinux => 'Fake kernel line BOOT/DEBIAN_8_1_X86_64_VMLINUZ',
|
|
23
|
-
:files => [[['BOOT/DEBIAN_8_1_X86_64_VMLINUZ', '/tmp/pxeboot/vmlinuz']],
|
|
24
|
-
[['BOOT/DEBIAN_8_1_X86_64_INITRD_IMG', '/tmp/pxeboot/initrd.img']]] }, anything)
|
|
25
|
-
ForemanBootdisk::ISOGenerator.generate_full_host(@host)
|
|
26
|
-
end
|
|
16
|
+
setup do
|
|
17
|
+
host.stubs(:provisioning_template).with(kind: :PXELinux).returns(template)
|
|
18
|
+
end
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
test 'fetch handles redirect' do
|
|
21
|
+
Dir.mktmpdir do |dir|
|
|
22
|
+
url = 'http://example.com/request'
|
|
23
|
+
redirection = 'http://example.com/redirect'
|
|
24
|
+
stub_request(:get, url).to_return(status: 301, headers: { 'Location' => redirection })
|
|
25
|
+
stub_request(:get, redirection)
|
|
26
|
+
ForemanBootdisk::ISOGenerator.fetch(File.join(dir, 'test'), url)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
test 'generate_full_host creates with ISO-compatible file names' do
|
|
31
|
+
urls = host.operatingsystem.boot_file_sources(host.medium_provider)
|
|
32
|
+
|
|
33
|
+
kernel = ForemanBootdisk::ISOGenerator.iso9660_filename(
|
|
34
|
+
host.operatingsystem.kernel(host.medium_provider)
|
|
35
|
+
)
|
|
36
|
+
kernel_url = urls[:kernel]
|
|
37
|
+
|
|
38
|
+
initrd = ForemanBootdisk::ISOGenerator.iso9660_filename(
|
|
39
|
+
host.operatingsystem.initrd(host.medium_provider)
|
|
40
|
+
)
|
|
41
|
+
initrd_url = urls[:initrd]
|
|
42
|
+
|
|
43
|
+
ForemanBootdisk::ISOGenerator.expects(:generate).with({
|
|
44
|
+
isolinux: "Fake kernel line #{kernel} - #{initrd}",
|
|
45
|
+
files: { kernel => kernel_url,
|
|
46
|
+
initrd => initrd_url }
|
|
47
|
+
}, anything)
|
|
48
|
+
|
|
49
|
+
ForemanBootdisk::ISOGenerator.generate_full_host(host)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe '#generate' do
|
|
54
|
+
test 'generates an iso image' do
|
|
55
|
+
ForemanBootdisk::ISOGenerator.expects(:system).with(
|
|
56
|
+
regexp_matches(/genisoimage -o .*output.iso -iso-level 2 -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .*build/)
|
|
57
|
+
).returns(true)
|
|
58
|
+
ForemanBootdisk::ISOGenerator.expects(:system).with('isohybrid', anything).returns(true)
|
|
59
|
+
ForemanBootdisk::ISOGenerator.generate do |iso|
|
|
60
|
+
assert_not_nil iso
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe '#iso9660_filename' do
|
|
66
|
+
test 'converts path to iso9660' do
|
|
67
|
+
assert_equal 'BOOT/SOME_FILE_N_A_M_E123_', ForemanBootdisk::ISOGenerator.iso9660_filename('boot/some-File-n_a_m_e123Ä')
|
|
68
|
+
end
|
|
41
69
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
ForemanBootdisk::ISOGenerator.generate_full_host(@host)
|
|
70
|
+
test 'shortens long filenames' do
|
|
71
|
+
assert_equal 'BOOT/RPRISELINUXATOMIC_7_3_X86_64', ForemanBootdisk::ISOGenerator.iso9660_filename('boot/RedHatEnterpriseLinuxAtomic-7.3-x86_64')
|
|
72
|
+
end
|
|
73
|
+
end
|
|
47
74
|
end
|
|
48
75
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,71 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_bootdisk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 16.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: 2019-
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
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-performance
|
|
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-rails
|
|
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: webmock
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
13
69
|
description: Plugin for Foreman that creates iPXE-based boot disks to provision hosts
|
|
14
70
|
without the need for PXE infrastructure.
|
|
15
71
|
email: dcleal@redhat.com
|
|
@@ -21,6 +77,7 @@ extra_rdoc_files:
|
|
|
21
77
|
- README.md
|
|
22
78
|
files:
|
|
23
79
|
- ".tx/config"
|
|
80
|
+
- AUTHORS
|
|
24
81
|
- CHANGES.md
|
|
25
82
|
- LICENSE
|
|
26
83
|
- README.md
|
|
@@ -29,15 +86,17 @@ files:
|
|
|
29
86
|
- app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb
|
|
30
87
|
- app/controllers/foreman_bootdisk/disks_controller.rb
|
|
31
88
|
- app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb
|
|
89
|
+
- app/lib/foreman_bootdisk/scope/bootdisk.rb
|
|
90
|
+
- app/lib/foreman_bootdisk/scope/full_host_bootdisk.rb
|
|
32
91
|
- app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb
|
|
33
92
|
- app/models/concerns/foreman_bootdisk/host_ext.rb
|
|
34
93
|
- app/models/concerns/foreman_bootdisk/orchestration/compute.rb
|
|
35
94
|
- app/models/setting/bootdisk.rb
|
|
36
95
|
- app/services/foreman_bootdisk/iso_generator.rb
|
|
37
96
|
- app/services/foreman_bootdisk/renderer.rb
|
|
38
|
-
- app/services/foreman_bootdisk/renderer_methods.rb
|
|
39
97
|
- app/views/foreman_bootdisk/disks/help.html.erb
|
|
40
98
|
- app/views/foreman_bootdisk/generic_host.erb
|
|
99
|
+
- app/views/foreman_bootdisk/generic_static_host.erb
|
|
41
100
|
- app/views/foreman_bootdisk/host.erb
|
|
42
101
|
- app/views/hosts/provision_method/bootdisk/_form.html.erb
|
|
43
102
|
- config/routes.rb
|
|
@@ -86,14 +145,19 @@ files:
|
|
|
86
145
|
- locale/zh_CN/foreman_bootdisk.po
|
|
87
146
|
- locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo
|
|
88
147
|
- locale/zh_TW/foreman_bootdisk.po
|
|
148
|
+
- release-gem
|
|
89
149
|
- test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb
|
|
90
150
|
- test/functional/foreman_bootdisk/api/v2/subnet_disks_controller_test.rb
|
|
91
151
|
- test/functional/foreman_bootdisk/disks_controller_test.rb
|
|
152
|
+
- test/models/host/managed_test.rb
|
|
92
153
|
- test/test_plugin_helper.rb
|
|
93
154
|
- test/unit/access_permissions_test.rb
|
|
94
155
|
- test/unit/concerns/compute_resources/vmware_test.rb
|
|
95
156
|
- test/unit/concerns/host_test.rb
|
|
96
157
|
- test/unit/concerns/orchestration/compute_test.rb
|
|
158
|
+
- test/unit/foreman_bootdisk/renderer_test.rb
|
|
159
|
+
- test/unit/foreman_bootdisk/scope/bootdisk_test.rb
|
|
160
|
+
- test/unit/foreman_bootdisk/scope/full_host_bootdisk_test.rb
|
|
97
161
|
- test/unit/iso_generator_test.rb
|
|
98
162
|
homepage: http://github.com/theforeman/foreman_bootdisk
|
|
99
163
|
licenses:
|
|
@@ -115,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
115
179
|
version: '0'
|
|
116
180
|
requirements: []
|
|
117
181
|
rubyforge_project:
|
|
118
|
-
rubygems_version: 2.7.6
|
|
182
|
+
rubygems_version: 2.7.6.2
|
|
119
183
|
signing_key:
|
|
120
184
|
specification_version: 4
|
|
121
185
|
summary: Create boot disks to provision hosts with Foreman
|