foreman_bootdisk 12.0.1 → 16.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a69fd6de3a18c8670dfe431cf989b8c02f94b9aa48da2c17aa93e504d98f869
|
4
|
+
data.tar.gz: 7354aff9025bfdd9f1acd3e312b2350268866b108a534dc3143b99ff731de1b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe67673899bbaf6b8588103341bf6f8436aecc7d761e574f9c835940d530eb199bbc29c44a61234710abd7ec00a76e2e89dc7ecbcb17211a0c7ff5df27d8c16
|
7
|
+
data.tar.gz: 70838f0a73b4c1541bc728de2f0399aa3946da0714e31b05d1dee08a7254aa6be8c1cd0a3b769dcfa566b21963fd9fb0591792e23758c6ceeb4885a1a2a3ff20
|
data/AUTHORS
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Bryan Kearney
|
2
|
+
Dominic Cleal
|
3
|
+
Greg Sutcliffe
|
4
|
+
Ido Kanner
|
5
|
+
Jon Fautley
|
6
|
+
Justin Sherrill
|
7
|
+
Lukas Zapletal
|
8
|
+
Lukáš Zapletal
|
9
|
+
Marek Hulan
|
10
|
+
Marek Hulán
|
11
|
+
Martin Bačovský
|
12
|
+
Michael Hofer
|
13
|
+
Michael Moll
|
14
|
+
Ohad Levy
|
15
|
+
Ondrej Prazak
|
16
|
+
Ondřej Ezr
|
17
|
+
Ondřej Pražák
|
18
|
+
Robert Antoni Buj Gelonch
|
19
|
+
Rohan21Lobo
|
20
|
+
Ronald van Zantvoort
|
21
|
+
Sam Kottler
|
22
|
+
Sean O'Keeffe
|
23
|
+
Stephen Benjamin
|
24
|
+
Swapnil Abnave
|
25
|
+
Timo Goebel
|
26
|
+
crito
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v14.0.0
|
4
|
+
* use new medium provider framework
|
5
|
+
* droped some unused code
|
6
|
+
|
7
|
+
## v13.0.0
|
8
|
+
* static credentials failover
|
9
|
+
* Rails 5.2 support
|
10
|
+
* use of core new renderer framework
|
11
|
+
|
3
12
|
## v12.0.0
|
4
13
|
* fixed subnet image token stub (#22428)
|
5
14
|
* moved MAC based identification to Foreman core (#22858)
|
data/README.md
CHANGED
@@ -47,6 +47,9 @@ gPXE images are unsupported due to lack of initrd support.
|
|
47
47
|
| >= 1.15 | ~> 10.0 |
|
48
48
|
| >= 1.17 | ~> 11.0 |
|
49
49
|
| >= 1.18 | ~> 12.0 |
|
50
|
+
| >= 1.19 | ~> 13.0 |
|
51
|
+
| >= 1.20 | ~> 14.0 |
|
52
|
+
| >= 1.21 | ~> 15.0 |
|
50
53
|
|
51
54
|
# Usage
|
52
55
|
|
@@ -233,6 +236,22 @@ To generate from the command line on the Foreman server:
|
|
233
236
|
Set `OUTPUT=/path` to change the output destination path (directory or file).
|
234
237
|
It must be writable by the 'foreman' user.
|
235
238
|
|
239
|
+
### Generic static image
|
240
|
+
|
241
|
+
This is generic image type which asks for network credentials instead of doing
|
242
|
+
DHCP request. Tokens must be turned off in order to find the host by MAC
|
243
|
+
address. To do that, set Token duration to 0 in Administer - Settings.
|
244
|
+
|
245
|
+
- Network interface name
|
246
|
+
- IP Address
|
247
|
+
- Netmask
|
248
|
+
- Gateway
|
249
|
+
- DNS
|
250
|
+
|
251
|
+
To use generic static host image, set "Generic image template" to "Bootdisk
|
252
|
+
iPXE - host template" in Administer - Settings - Boot disk. Only one template
|
253
|
+
can be used at one time across all hosts.
|
254
|
+
|
236
255
|
### Subnet images
|
237
256
|
|
238
257
|
Subnet images are similar to generic images, but chain-loading is done via the
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'uri'
|
2
4
|
|
3
5
|
module ForemanBootdisk
|
@@ -7,10 +9,10 @@ module ForemanBootdisk
|
|
7
9
|
include ::Api::Version2
|
8
10
|
|
9
11
|
resource_description do
|
10
|
-
api_base_url
|
12
|
+
api_base_url '/bootdisk/api'
|
11
13
|
end
|
12
14
|
|
13
|
-
before_action :find_resource, :
|
15
|
+
before_action :find_resource, only: :host
|
14
16
|
skip_after_action :log_response_body
|
15
17
|
|
16
18
|
# no-op, but required for apipie documentation
|
@@ -20,24 +22,24 @@ module ForemanBootdisk
|
|
20
22
|
api :GET, '/generic', N_('Download generic image')
|
21
23
|
def generic
|
22
24
|
tmpl = ForemanBootdisk::Renderer.new.generic_template_render
|
23
|
-
ForemanBootdisk::ISOGenerator.generate(:
|
24
|
-
send_data read_file(iso), :
|
25
|
+
ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso|
|
26
|
+
send_data read_file(iso), filename: "bootdisk_#{URI.parse(Setting[:foreman_url]).host}.iso"
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
api :GET, '/hosts/:host_id', N_('Download host image')
|
29
|
-
param :full, :bool, :
|
30
|
-
param :host_id, :identifier_dottable, :
|
31
|
+
param :full, :bool, required: false, desc: N_('True for full, false for basic reusable image')
|
32
|
+
param :host_id, :identifier_dottable, required: true
|
31
33
|
def host
|
32
34
|
host = @disk
|
33
35
|
if params[:full]
|
34
36
|
ForemanBootdisk::ISOGenerator.generate_full_host(host) do |iso|
|
35
|
-
send_data read_file(iso), :
|
37
|
+
send_data read_file(iso), filename: "#{host.name}#{ForemanBootdisk::ISOGenerator.token_expiry(host)}.iso"
|
36
38
|
end
|
37
39
|
else
|
38
40
|
tmpl = host.bootdisk_template_render
|
39
|
-
ForemanBootdisk::ISOGenerator.generate(:
|
40
|
-
send_data read_file(iso), :
|
41
|
+
ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso|
|
42
|
+
send_data read_file(iso), filename: "#{host.name}.iso"
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -1,37 +1,43 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module ForemanBootdisk::Api::V2
|
4
|
-
class SubnetDisksController < ::Api::V2::BaseController
|
5
|
-
include ::Api::Version2
|
6
|
-
|
7
|
-
resource_description do
|
8
|
-
api_base_url "/bootdisk/api"
|
9
|
-
end
|
10
|
-
|
11
|
-
before_action :find_resource, :only => :subnet
|
1
|
+
# frozen_string_literal: true
|
12
2
|
|
13
|
-
|
14
|
-
|
15
|
-
# no-op, but required for apipie documentation
|
16
|
-
api :GET, '', N_('Subnet boot disks')
|
17
|
-
def index; end
|
3
|
+
require 'uri'
|
18
4
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
5
|
+
module ForemanBootdisk
|
6
|
+
module Api
|
7
|
+
module V2
|
8
|
+
class SubnetDisksController < ::Api::V2::BaseController
|
9
|
+
include ::Api::Version2
|
10
|
+
|
11
|
+
resource_description do
|
12
|
+
api_base_url '/bootdisk/api'
|
13
|
+
end
|
14
|
+
|
15
|
+
before_action :find_resource, only: :subnet
|
16
|
+
|
17
|
+
skip_after_action :log_response_body
|
18
|
+
|
19
|
+
# no-op, but required for apipie documentation
|
20
|
+
api :GET, '', N_('Subnet boot disks')
|
21
|
+
def index; end
|
22
|
+
|
23
|
+
api :GET, '/subnets/:subnet_id', N_('Download subnet generic image')
|
24
|
+
param :subnet_id, :identifier_dottable, required: true
|
25
|
+
def subnet
|
26
|
+
subnet = @subnet_disk
|
27
|
+
subnet.tftp || raise(::Foreman::Exception.new(N_('TFTP feature not enabled for subnet %s'), subnet.name))
|
28
|
+
tmpl = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
|
29
|
+
ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso|
|
30
|
+
name = subnet.name
|
31
|
+
send_data File.read(iso), filename: "bootdisk_subnet_#{name}.iso"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def resource_scope
|
38
|
+
Subnet.authorized('view_subnets')
|
39
|
+
end
|
28
40
|
end
|
29
41
|
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def resource_scope
|
34
|
-
Subnet.authorized('view_subnets')
|
35
|
-
end
|
36
42
|
end
|
37
43
|
end
|
@@ -1,20 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'uri'
|
2
4
|
|
3
5
|
module ForemanBootdisk
|
4
6
|
class DisksController < ::ApplicationController
|
5
|
-
before_action :find_resource, :
|
7
|
+
before_action :find_resource, only: %w[host full_host subnet]
|
8
|
+
|
9
|
+
# as this engine is isolated, we need to include url helpers from core explicitly
|
10
|
+
# to render help page layout
|
11
|
+
include Rails.application.routes.url_helpers
|
6
12
|
|
7
13
|
def generic
|
8
14
|
begin
|
9
15
|
tmpl = ForemanBootdisk::Renderer.new.generic_template_render
|
10
|
-
rescue => e
|
16
|
+
rescue StandardError => e
|
11
17
|
error_rendering(e)
|
12
18
|
redirect_back(fallback_location: '/')
|
13
19
|
return
|
14
20
|
end
|
15
21
|
|
16
|
-
ForemanBootdisk::ISOGenerator.generate(:
|
17
|
-
send_data read_file(iso), :
|
22
|
+
ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso|
|
23
|
+
send_data read_file(iso), filename: "bootdisk_#{URI.parse(Setting[:foreman_url]).host}.iso"
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
@@ -22,43 +28,42 @@ module ForemanBootdisk
|
|
22
28
|
host = @disk
|
23
29
|
begin
|
24
30
|
tmpl = host.bootdisk_template_render
|
25
|
-
rescue => e
|
31
|
+
rescue StandardError => e
|
26
32
|
error_rendering(e)
|
27
33
|
redirect_back(fallback_location: '/')
|
28
34
|
return
|
29
35
|
end
|
30
36
|
|
31
|
-
ForemanBootdisk::ISOGenerator.generate(:
|
32
|
-
send_data read_file(iso), :
|
37
|
+
ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso|
|
38
|
+
send_data read_file(iso), filename: "#{host.name}.iso"
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
36
42
|
def full_host
|
37
43
|
host = @disk
|
38
44
|
ForemanBootdisk::ISOGenerator.generate_full_host(host) do |iso|
|
39
|
-
send_data read_file(iso), :
|
45
|
+
send_data read_file(iso), filename: "#{host.name}#{ForemanBootdisk::ISOGenerator.token_expiry(host)}.iso"
|
40
46
|
end
|
41
47
|
end
|
42
48
|
|
43
49
|
def subnet
|
44
50
|
host = @disk
|
45
51
|
begin
|
46
|
-
subnet = host.try(:subnet) || raise(::Foreman::Exception.new(N_(
|
47
|
-
subnet.tftp || raise(::Foreman::Exception.new(N_(
|
52
|
+
subnet = host.try(:subnet) || raise(::Foreman::Exception.new(N_('Subnet is not assigned to the host %s'), host.name))
|
53
|
+
subnet.tftp || raise(::Foreman::Exception.new(N_('TFTP feature not enabled for subnet %s'), subnet.name))
|
48
54
|
tmpl = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
|
49
|
-
rescue => e
|
55
|
+
rescue StandardError => e
|
50
56
|
error_rendering(e)
|
51
57
|
redirect_back(fallback_location: '/')
|
52
58
|
return
|
53
59
|
end
|
54
60
|
|
55
|
-
ForemanBootdisk::ISOGenerator.generate(:
|
56
|
-
send_data read_file(iso), :
|
61
|
+
ForemanBootdisk::ISOGenerator.generate(ipxe: tmpl) do |iso|
|
62
|
+
send_data read_file(iso), filename: "bootdisk_subnet_#{subnet.name}.iso"
|
57
63
|
end
|
58
64
|
end
|
59
65
|
|
60
|
-
def help
|
61
|
-
end
|
66
|
+
def help; end
|
62
67
|
|
63
68
|
private
|
64
69
|
|
@@ -66,14 +71,14 @@ module ForemanBootdisk
|
|
66
71
|
File.read(filename)
|
67
72
|
end
|
68
73
|
|
69
|
-
def resource_scope(
|
74
|
+
def resource_scope(_controller = controller_name)
|
70
75
|
Host::Managed.authorized(:view_hosts)
|
71
76
|
end
|
72
77
|
|
73
|
-
def error_rendering(
|
78
|
+
def error_rendering(exception)
|
74
79
|
msg = _('Failed to render boot disk template')
|
75
|
-
error("#{msg}: #{
|
76
|
-
::Foreman::Logging.exception(msg,
|
80
|
+
error("#{msg}: #{exception.message}")
|
81
|
+
::Foreman::Logging.exception(msg, exception)
|
77
82
|
end
|
78
83
|
end
|
79
84
|
end
|
@@ -1,58 +1,99 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForemanBootdisk
|
4
|
+
module HostsHelperExt
|
5
|
+
def host_title_actions(host)
|
6
|
+
if host.bootdisk_downloadable?
|
7
|
+
title_actions(
|
8
|
+
button_group(
|
9
|
+
select_action_button(
|
10
|
+
_('Boot disk'), { class: 'btn btn-group' },
|
11
|
+
display_bootdisk_link_if_authorized(
|
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
|
+
)
|
47
|
+
)
|
14
48
|
)
|
15
49
|
)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
50
|
+
else
|
51
|
+
bootdisk_button_disabled(host)
|
52
|
+
end
|
20
53
|
|
21
|
-
|
22
|
-
|
54
|
+
super
|
55
|
+
end
|
23
56
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
57
|
+
def bootdisk_button_disabled(host)
|
58
|
+
title_actions(
|
59
|
+
button_group(
|
60
|
+
link_to(_('Boot disk'), '#', disabled: true, class: 'btn btn-default',
|
61
|
+
title: _('Boot disk download not available for %s architecture') % host.architecture.name)
|
62
|
+
)
|
29
63
|
)
|
30
|
-
|
31
|
-
end
|
64
|
+
end
|
32
65
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
66
|
+
# need to wrap this one in a test for template proxy presence
|
67
|
+
def display_bootdisk_for_subnet(host)
|
68
|
+
if (proxy = host.try(:subnet).try(:tftp)) && proxy.has_feature?('Templates')
|
69
|
+
display_bootdisk_link_if_authorized(
|
70
|
+
_("Subnet '%s' generic image") % host.subnet.name, {
|
71
|
+
controller: 'foreman_bootdisk/disks',
|
72
|
+
action: 'subnet',
|
73
|
+
id: host
|
74
|
+
},
|
75
|
+
class: 'la'
|
76
|
+
)
|
77
|
+
else
|
78
|
+
''
|
79
|
+
end
|
39
80
|
end
|
40
|
-
end
|
41
81
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
82
|
+
# Core Foreman helpers can't look up a URL against a mounted engine
|
83
|
+
def display_bootdisk_link_if_authorized(name, options = {}, html_options = {})
|
84
|
+
if bootdisk_authorized_for(options)
|
85
|
+
link_to(name, bootdisk_url(options), html_options)
|
86
|
+
else
|
87
|
+
''
|
88
|
+
end
|
48
89
|
end
|
49
|
-
end
|
50
90
|
|
51
|
-
|
52
|
-
|
53
|
-
|
91
|
+
def bootdisk_url(options)
|
92
|
+
ForemanBootdisk::Engine.routes.url_for(options.merge(only_path: true, script_name: foreman_bootdisk_path))
|
93
|
+
end
|
54
94
|
|
55
|
-
|
56
|
-
|
95
|
+
def bootdisk_authorized_for(options)
|
96
|
+
User.current.allowed_to?(options)
|
97
|
+
end
|
57
98
|
end
|
58
99
|
end
|