foreman_bootdisk 15.0.0 → 17.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yaml +19 -0
  3. data/.tx/config +1 -1
  4. data/AUTHORS +11 -0
  5. data/README.md +25 -0
  6. data/app/controllers/concerns/allowed_actions.rb +16 -0
  7. data/app/controllers/foreman_bootdisk/api/v2/disks_controller.rb +9 -7
  8. data/app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb +16 -4
  9. data/app/controllers/foreman_bootdisk/disks_controller.rb +14 -10
  10. data/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb +71 -45
  11. data/app/lib/foreman_bootdisk/scope/bootdisk.rb +28 -1
  12. data/app/lib/foreman_bootdisk/scope/full_host_bootdisk_efi.rb +15 -0
  13. data/app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb +10 -1
  14. data/app/models/concerns/foreman_bootdisk/host_ext.rb +13 -6
  15. data/app/models/concerns/foreman_bootdisk/orchestration/compute.rb +38 -22
  16. data/app/models/setting/bootdisk.rb +25 -19
  17. data/app/services/foreman_bootdisk/iso_generator.rb +132 -51
  18. data/app/services/foreman_bootdisk/renderer.rb +36 -19
  19. data/app/views/foreman_bootdisk/generic_efi_host.erb +68 -0
  20. data/app/views/foreman_bootdisk/generic_static_host.erb +34 -0
  21. data/app/views/foreman_bootdisk/host.erb +29 -8
  22. data/db/seeds.d/50-bootdisk_templates.rb +15 -31
  23. data/lib/foreman_bootdisk/engine.rb +9 -6
  24. data/lib/foreman_bootdisk/version.rb +1 -1
  25. data/lib/tasks/bootdisk.rake +10 -24
  26. data/locale/action_names.rb +7 -0
  27. data/locale/ca/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  28. data/locale/ca/foreman_bootdisk.po +58 -7
  29. data/locale/de/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  30. data/locale/de/foreman_bootdisk.po +62 -11
  31. data/locale/en/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  32. data/locale/en/foreman_bootdisk.po +56 -5
  33. data/locale/en_GB/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  34. data/locale/en_GB/foreman_bootdisk.po +62 -11
  35. data/locale/es/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  36. data/locale/es/foreman_bootdisk.po +62 -11
  37. data/locale/foreman_bootdisk.pot +108 -36
  38. data/locale/fr/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  39. data/locale/fr/foreman_bootdisk.po +61 -10
  40. data/locale/it/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  41. data/locale/it/foreman_bootdisk.po +60 -9
  42. data/locale/ja/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  43. data/locale/ja/foreman_bootdisk.po +61 -10
  44. data/locale/ko/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  45. data/locale/ko/foreman_bootdisk.po +60 -9
  46. data/locale/pt_BR/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  47. data/locale/pt_BR/foreman_bootdisk.po +60 -9
  48. data/locale/ru/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  49. data/locale/ru/foreman_bootdisk.po +60 -9
  50. data/locale/sv_SE/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  51. data/locale/sv_SE/foreman_bootdisk.po +59 -8
  52. data/locale/zh_CN/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  53. data/locale/zh_CN/foreman_bootdisk.po +60 -9
  54. data/locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  55. data/locale/zh_TW/foreman_bootdisk.po +60 -9
  56. data/release-gem +2 -0
  57. data/test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb +51 -17
  58. data/test/functional/foreman_bootdisk/api/v2/subnet_disks_controller_test.rb +23 -10
  59. data/test/functional/foreman_bootdisk/disks_controller_test.rb +65 -25
  60. data/test/test_plugin_helper.rb +21 -3
  61. data/test/unit/concerns/host_test.rb +12 -1
  62. data/test/unit/concerns/orchestration/compute_test.rb +32 -13
  63. data/test/unit/foreman_bootdisk/renderer_test.rb +1 -1
  64. data/test/unit/iso_generator_test.rb +6 -7
  65. metadata +14 -9
@@ -5,10 +5,10 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_bootdisk 14.0.0\n"
8
+ "Project-Id-Version: foreman_bootdisk 17.0.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "PO-Revision-Date: 2019-04-18 20:22+0000\n"
11
- "Last-Translator: Lukáš Zapletal\n"
10
+ "PO-Revision-Date: 2019-10-22 20:06+0000\n"
11
+ "Last-Translator: Bryan Kearney <bryan.kearney@gmail.com>\n"
12
12
  "Language-Team: Chinese (China) (http://www.transifex.com/foreman/foreman/langu"
13
13
  "age/zh_CN/)\n"
14
14
  "MIME-Version: 1.0\n"
@@ -20,6 +20,9 @@ msgstr ""
20
20
  msgid "A variant of the per-host image which contains the OS bootloader embedded inside the disk. This may be useful if chainloading fails on certain hardware, but has the downside that the image must be regenerated for any change in the OS, bootloader or PXELinux templates."
21
21
  msgstr "每个包含磁盘内置 OS 引导装载程序的主机映像变体。如果某个硬件中的链载入失败,这个变体可能会有帮助,但缺点是必须为所有 OS、引导装载程序或 PXELinux 模板中的所有更改重新生成该映像。"
22
22
 
23
+ msgid "Action with sub plans"
24
+ msgstr "带有子计划的操作"
25
+
23
26
  msgid "All images are usable as either ISOs or as disk images, including being written to a USB disk with `dd`."
24
27
  msgstr "所有映像都可作为 ISO 或者磁盘映像使用,包括使用 `dd` 写入的 USB盘。"
25
28
 
@@ -44,9 +47,18 @@ msgstr "引导磁盘内嵌的模板"
44
47
  msgid "Boot disks"
45
48
  msgstr "引导磁盘"
46
49
 
50
+ msgid "Both IP and Subnet must be set"
51
+ msgstr ""
52
+
47
53
  msgid "Command to generate ISO image, use genisoimage or mkisofs"
48
54
  msgstr "使用 genisoimage 或者 mkisofs 命令生成 ISO 映像。"
49
55
 
56
+ msgid "Creating new image failed, install truncate utility"
57
+ msgstr ""
58
+
59
+ msgid "Detach ISO image from CDROM drive for %s"
60
+ msgstr ""
61
+
50
62
  msgid "Download generic image"
51
63
  msgstr "下载通用映像"
52
64
 
@@ -56,9 +68,21 @@ msgstr "下载主机映像"
56
68
  msgid "Download subnet generic image"
57
69
  msgstr "下载子网通用映象"
58
70
 
71
+ msgid "Ensure %{path} contains grubx64.efi and shimx64.efi: install TFTP module or copy those files into /var/lib/foreman/bootdisk (Grub2 directory setting)"
72
+ msgstr ""
73
+
59
74
  msgid "Failed to attach ISO image to CDROM drive of instance %{name}: %{message}"
60
75
  msgstr "未能成功将 ISO 映像附加到实例 %{name} 的 CDROM 驱动:%{message}"
61
76
 
77
+ msgid "Failed to create a directory within the ESP image"
78
+ msgstr ""
79
+
80
+ msgid "Failed to detach ISO image from CDROM drive of instance %{name}: %{message}"
81
+ msgstr ""
82
+
83
+ msgid "Failed to format the ESP image via mkfs.msdos"
84
+ msgstr ""
85
+
62
86
  msgid "Failed to generate ISO image for instance %{name}: %{message}"
63
87
  msgstr "为实例 %{name} 生成 ISO 映像失败:%{message}"
64
88
 
@@ -77,6 +101,9 @@ msgstr "完整主机映像"
77
101
  msgid "Generating ISO image for %s"
78
102
  msgstr "为 %s 生成 ISO 映像"
79
103
 
104
+ msgid "Generic Grub2 EFI image template"
105
+ msgstr ""
106
+
80
107
  msgid "Generic image"
81
108
  msgstr "原始映像"
82
109
 
@@ -86,14 +113,23 @@ msgstr "原始映像模板"
86
113
  msgid "Generic images are a reusable disk image that works for any host registered in Foreman. It requires a basic DHCP and DNS service to function and contact the server, but does not require DHCP reservations or static IP addresses."
87
114
  msgstr "通用映像是可重复使用的映像,可用于 Foreman 中注册的所有主机。它要求使用 DHCP 和 DNS 服务与服务器联络,但不要求 DHCP 预订或静态 IP 地址。"
88
115
 
116
+ msgid "Grub2 directory"
117
+ msgstr ""
118
+
119
+ msgid "Grub2 template to use for generic EFI host boot disks"
120
+ msgstr ""
121
+
89
122
  msgid "Help"
90
123
  msgstr "帮助"
91
124
 
92
125
  msgid "Host '%s' image"
93
126
  msgstr "主机 '%s' 映像"
94
127
 
95
- msgid "Host has no IP address defined"
96
- msgstr "没有为主机定义 IP 地址"
128
+ msgid "Host bootdisk does not work with static IPv6"
129
+ msgstr ""
130
+
131
+ msgid "Host has no IPv4 or IPv6 address defined"
132
+ msgstr ""
97
133
 
98
134
  msgid "Host has no domain defined"
99
135
  msgstr "没有为主机定义域"
@@ -119,12 +155,18 @@ msgstr "ISO 构建失败"
119
155
  msgid "ISO generation command"
120
156
  msgstr "ISO 生成命令"
121
157
 
122
- msgid "ISO hybrid conversion failed"
123
- msgstr "ISO 复合转换失败"
158
+ msgid "ISO hybrid conversion failed: %s"
159
+ msgstr ""
124
160
 
125
161
  msgid "ISOLINUX directory"
126
162
  msgstr "ISOLINUX 目录"
127
163
 
164
+ msgid "Import Puppet classes"
165
+ msgstr "导入 Puppet 类"
166
+
167
+ msgid "Import facts"
168
+ msgstr "导入 fact"
169
+
128
170
  msgid "Installation media caching"
129
171
  msgstr "安装介质缓存"
130
172
 
@@ -134,6 +176,9 @@ msgstr "可为完整主机映像缓存安装介质文件"
134
176
  msgid "Once chainloaded, the OS bootloader and installer are downloaded directly from the installation media configured in Foreman, and the provisioning script (kickstart/preseed) is downloaded from Foreman."
135
177
  msgstr "链载入后,即可从 Foreman 中配置的安装介质直接下载 OS 引导装载程序和安装程序,并可从 Foreman 中下载供应脚本(kickstart/preseed)。"
136
178
 
179
+ msgid "Path to directory containing grubx64.efi and shimx64.efi"
180
+ msgstr ""
181
+
137
182
  msgid "Path to directory containing iPXE images"
138
183
  msgstr "包含 iPXE 映像目录的路径"
139
184
 
@@ -155,6 +200,9 @@ msgstr "请确保已安装 isolinux/syslinux 软件包。"
155
200
  msgid "Plugin for Foreman that creates iPXE-based boot disks to provision hosts without the need for PXE infrastructure."
156
201
  msgstr "为 Foreman 生成基于 iPXE 的引导磁盘的插件,在不需要 PXE 架构的条件下即可供应主机。"
157
202
 
203
+ msgid "Remote action:"
204
+ msgstr "远程操作:"
205
+
158
206
  msgid "SYSLINUX directory"
159
207
  msgstr "SYSLINUX 目录"
160
208
 
@@ -188,10 +236,13 @@ msgstr "True 代表完整映像,false 代表基本可重复使用映像。"
188
236
  msgid "Unable to find template specified by %s setting"
189
237
  msgstr "无法找到 %s 设置指定的模板"
190
238
 
191
- msgid "Unable to generate disk PXELinux template: %s"
239
+ msgid "Unable to generate disk %{kind} template: %{error}"
240
+ msgstr ""
241
+
242
+ msgid "Unable to generate disk template, %{kind} template not found."
192
243
  msgstr ""
193
244
 
194
- msgid "Unable to generate disk template, PXELinux template not found."
245
+ msgid "Unable to mcopy %{path}"
195
246
  msgstr ""
196
247
 
197
248
  msgid "Upload ISO image to datastore for %s"
@@ -5,10 +5,10 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_bootdisk 14.0.0\n"
8
+ "Project-Id-Version: foreman_bootdisk 17.0.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "PO-Revision-Date: 2019-04-18 20:22+0000\n"
11
- "Last-Translator: Lukáš Zapletal\n"
10
+ "PO-Revision-Date: 2019-10-22 20:06+0000\n"
11
+ "Last-Translator: Bryan Kearney <bryan.kearney@gmail.com>\n"
12
12
  "Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/lang"
13
13
  "uage/zh_TW/)\n"
14
14
  "MIME-Version: 1.0\n"
@@ -20,6 +20,9 @@ msgstr ""
20
20
  msgid "A variant of the per-host image which contains the OS bootloader embedded inside the disk. This may be useful if chainloading fails on certain hardware, but has the downside that the image must be regenerated for any change in the OS, bootloader or PXELinux templates."
21
21
  msgstr "個別主機映像檔的變體,磁碟中嵌入了 OS 的開機載入程式。這對於在特定硬體上的 chainloading 失敗時特別有幫助,不過缺點就是若要對 OS、開機載入程式或 PXELinux 範本進行任何更改,映像檔就必須重新產生。"
22
22
 
23
+ msgid "Action with sub plans"
24
+ msgstr "有子計畫的動作"
25
+
23
26
  msgid "All images are usable as either ISOs or as disk images, including being written to a USB disk with `dd`."
24
27
  msgstr "所有映像檔皆能作為 ISO 或是磁碟映像檔使用,包括以 `dd` 寫入一個 USB 磁碟中。"
25
28
 
@@ -44,9 +47,18 @@ msgstr ""
44
47
  msgid "Boot disks"
45
48
  msgstr "開機磁碟"
46
49
 
50
+ msgid "Both IP and Subnet must be set"
51
+ msgstr ""
52
+
47
53
  msgid "Command to generate ISO image, use genisoimage or mkisofs"
48
54
  msgstr "請使用 genisoimage 或是 mkisofs 來作為產生 ISO 映像檔的指令"
49
55
 
56
+ msgid "Creating new image failed, install truncate utility"
57
+ msgstr ""
58
+
59
+ msgid "Detach ISO image from CDROM drive for %s"
60
+ msgstr ""
61
+
50
62
  msgid "Download generic image"
51
63
  msgstr "下載泛型映像檔"
52
64
 
@@ -56,9 +68,21 @@ msgstr "下載主機映像檔"
56
68
  msgid "Download subnet generic image"
57
69
  msgstr "下載子網路泛型映像檔"
58
70
 
71
+ msgid "Ensure %{path} contains grubx64.efi and shimx64.efi: install TFTP module or copy those files into /var/lib/foreman/bootdisk (Grub2 directory setting)"
72
+ msgstr ""
73
+
59
74
  msgid "Failed to attach ISO image to CDROM drive of instance %{name}: %{message}"
60
75
  msgstr ""
61
76
 
77
+ msgid "Failed to create a directory within the ESP image"
78
+ msgstr ""
79
+
80
+ msgid "Failed to detach ISO image from CDROM drive of instance %{name}: %{message}"
81
+ msgstr ""
82
+
83
+ msgid "Failed to format the ESP image via mkfs.msdos"
84
+ msgstr ""
85
+
62
86
  msgid "Failed to generate ISO image for instance %{name}: %{message}"
63
87
  msgstr ""
64
88
 
@@ -77,6 +101,9 @@ msgstr "完整的主機映像檔"
77
101
  msgid "Generating ISO image for %s"
78
102
  msgstr ""
79
103
 
104
+ msgid "Generic Grub2 EFI image template"
105
+ msgstr ""
106
+
80
107
  msgid "Generic image"
81
108
  msgstr "泛型映像檔"
82
109
 
@@ -86,14 +113,23 @@ msgstr ""
86
113
  msgid "Generic images are a reusable disk image that works for any host registered in Foreman. It requires a basic DHCP and DNS service to function and contact the server, but does not require DHCP reservations or static IP addresses."
87
114
  msgstr "泛型映像檔是個可重複使用的磁碟映像檔,並且可使用於任何向 Foreman 註冊過的主機上。它需要一項基本的 DHCP 和 DNS 服務才能運作和聯絡伺服器,不過並不需要 DHCP 預留或靜態 IP 位址。"
88
115
 
116
+ msgid "Grub2 directory"
117
+ msgstr ""
118
+
119
+ msgid "Grub2 template to use for generic EFI host boot disks"
120
+ msgstr ""
121
+
89
122
  msgid "Help"
90
123
  msgstr "協助"
91
124
 
92
125
  msgid "Host '%s' image"
93
126
  msgstr "主機「%s」映像檔"
94
127
 
95
- msgid "Host has no IP address defined"
96
- msgstr "主機尚未定義 IP 位址"
128
+ msgid "Host bootdisk does not work with static IPv6"
129
+ msgstr ""
130
+
131
+ msgid "Host has no IPv4 or IPv6 address defined"
132
+ msgstr ""
97
133
 
98
134
  msgid "Host has no domain defined"
99
135
  msgstr "主機尚未定義區域"
@@ -119,12 +155,18 @@ msgstr "建立 ISO 失敗"
119
155
  msgid "ISO generation command"
120
156
  msgstr ""
121
157
 
122
- msgid "ISO hybrid conversion failed"
123
- msgstr "ISO 混合式轉換失敗"
158
+ msgid "ISO hybrid conversion failed: %s"
159
+ msgstr ""
124
160
 
125
161
  msgid "ISOLINUX directory"
126
162
  msgstr ""
127
163
 
164
+ msgid "Import Puppet classes"
165
+ msgstr "匯入 Puppet 類別"
166
+
167
+ msgid "Import facts"
168
+ msgstr "匯入詳情"
169
+
128
170
  msgid "Installation media caching"
129
171
  msgstr ""
130
172
 
@@ -134,6 +176,9 @@ msgstr "安裝媒介檔案將會被快取以作為完整的主機映像檔"
134
176
  msgid "Once chainloaded, the OS bootloader and installer are downloaded directly from the installation media configured in Foreman, and the provisioning script (kickstart/preseed) is downloaded from Foreman."
135
177
  msgstr "在 chainload 之後,OS 開機載入程式和安裝程式將會直接從 Foreman 中所配置的安裝媒介下載,而佈建 script(kickstart/preseed)則會由 Foreman 下載。"
136
178
 
179
+ msgid "Path to directory containing grubx64.efi and shimx64.efi"
180
+ msgstr ""
181
+
137
182
  msgid "Path to directory containing iPXE images"
138
183
  msgstr "包含 iPXE 映像檔的目錄之路徑"
139
184
 
@@ -155,6 +200,9 @@ msgstr ""
155
200
  msgid "Plugin for Foreman that creates iPXE-based boot disks to provision hosts without the need for PXE infrastructure."
156
201
  msgstr "能建立基於 iPXE 的開機磁碟的 Foreman 外掛程式,以在不需要 PXE 設備的情況下佈建主機。"
157
202
 
203
+ msgid "Remote action:"
204
+ msgstr "遠端動作:"
205
+
158
206
  msgid "SYSLINUX directory"
159
207
  msgstr ""
160
208
 
@@ -188,10 +236,13 @@ msgstr "「true」代表完整,「false」則代表可重複使用的基本映
188
236
  msgid "Unable to find template specified by %s setting"
189
237
  msgstr "找不到 %s 設定所指定的範本"
190
238
 
191
- msgid "Unable to generate disk PXELinux template: %s"
239
+ msgid "Unable to generate disk %{kind} template: %{error}"
240
+ msgstr ""
241
+
242
+ msgid "Unable to generate disk template, %{kind} template not found."
192
243
  msgstr ""
193
244
 
194
- msgid "Unable to generate disk template, PXELinux template not found."
245
+ msgid "Unable to mcopy %{path}"
195
246
  msgstr ""
196
247
 
197
248
  msgid "Upload ISO image to datastore for %s"
data/release-gem CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/bin/env ruby
2
+ # frozen_string_literal: true
3
+ # rubocop:disable all
2
4
 
3
5
  $plugin_name = "foreman_bootdisk"
4
6
  RUBY_VERSION_FILE = "lib/#{$plugin_name}/version.rb"
@@ -5,33 +5,67 @@ require 'test_plugin_helper'
5
5
  class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
6
6
  include ForemanBootdiskTestHelper
7
7
  setup :setup_bootdisk
8
+ setup :setup_referer
9
+ setup :setup_org_loc
8
10
 
9
- test 'should generate generic image' do
10
- ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(ipxe: regexp_matches(/disk generic host template/))).yields('temp ISO')
11
- @controller.expects(:read_file).with('temp ISO').returns('ISO image')
11
+ def perform_generic_generate
12
+ tmp = create_tempfile
13
+ ForemanBootdisk::ISOGenerator.expects(:generate).yields(create_tempfile.path)
12
14
  get :generic
13
15
  assert_response :success
14
- assert_equal 'ISO image', @response.body
16
+ ensure
17
+ tmp.unlink
15
18
  end
16
19
 
17
- describe '#host' do
18
- setup :setup_referer
19
- setup :setup_host_env
20
+ def perform_host_generate
21
+ tmp = create_tempfile
22
+ ForemanBootdisk::ISOGenerator.expects(:generate).yields(create_tempfile.path)
23
+ get :host, params: { id: @host.name }
24
+ assert_response :success
25
+ ensure
26
+ tmp.unlink
27
+ end
28
+
29
+ def perform_full_host_generate
30
+ tmp = create_tempfile
31
+ ForemanBootdisk::ISOGenerator.expects(:generate_full_host).yields(create_tempfile.path)
32
+ get :host, params: { id: @host.name, full: true }
33
+ assert_response :success
34
+ ensure
35
+ tmp.unlink
36
+ end
37
+
38
+ describe '#generic with TFTP' do
39
+ setup :setup_subnet_with_tftp
40
+ setup :setup_host
41
+
42
+ test 'should generate generic image' do
43
+ perform_generic_generate
44
+ end
45
+
46
+ test 'should generate host image' do
47
+ perform_host_generate
48
+ end
49
+
50
+ test 'should generate full host image' do
51
+ perform_full_host_generate
52
+ end
53
+ end
54
+
55
+ describe '#subnet_host with TFTP and HTTPBOOT' do
56
+ setup :setup_subnet_with_tftp_httpboot_template
57
+ setup :setup_host
58
+
59
+ test 'should generate generic image' do
60
+ perform_generic_generate
61
+ end
20
62
 
21
63
  test 'should generate host image' do
22
- ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(ipxe: regexp_matches(/disk host template/))).yields('temp ISO')
23
- @controller.expects(:read_file).with('temp ISO').returns('ISO image')
24
- get :host, params: { id: @host.name }
25
- assert_response :success
26
- assert_equal 'ISO image', @response.body
64
+ perform_host_generate
27
65
  end
28
66
 
29
67
  test 'should generate full host image' do
30
- ForemanBootdisk::ISOGenerator.expects(:generate_full_host).with(@host).yields('temp ISO')
31
- @controller.expects(:read_file).with('temp ISO').returns('ISO image')
32
- get :host, params: { id: @host.name, full: true }
33
- assert_response :success
34
- assert_equal 'ISO image', @response.body
68
+ perform_full_host_generate
35
69
  end
36
70
  end
37
71
 
@@ -5,20 +5,33 @@ require 'test_plugin_helper'
5
5
  class ForemanBootdisk::Api::V2::SubnetDisksControllerTest < ActionController::TestCase
6
6
  include ForemanBootdiskTestHelper
7
7
  setup :setup_bootdisk
8
+ setup :setup_referer
9
+ setup :setup_org_loc
8
10
 
9
- describe '#subnet_host' do
10
- setup :setup_referer
11
- setup :setup_org_loc
12
- setup :setup_subnet
11
+ def perform_subnet_generate
12
+ tmp = create_tempfile
13
+ ForemanBootdisk::ISOGenerator.expects(:generate).yields(create_tempfile.path)
14
+ get :subnet, params: { id: @host.subnet.id }
15
+ assert_response :success
16
+ ensure
17
+ tmp.unlink
18
+ end
19
+
20
+ describe '#subnet_host with TFTP' do
21
+ setup :setup_subnet_with_tftp
22
+ setup :setup_host
23
+
24
+ test 'should generate subnet generic host image' do
25
+ perform_subnet_generate
26
+ end
27
+ end
28
+
29
+ describe '#subnet_host with TFTP and HTTPBOOT' do
30
+ setup :setup_subnet_with_tftp_httpboot_template
13
31
  setup :setup_host
14
32
 
15
33
  test 'should generate subnet generic host image' do
16
- ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(ipxe: regexp_matches(/disk generic host template/))).yields('temp ISO')
17
- ForemanBootdisk::Renderer.any_instance.stubs(:bootdisk_chain_url).yields('http://smart-proxy.lan')
18
- File.expects(:read).with('temp ISO').returns('ISO image')
19
- get :subnet, params: { id: @host.subnet.id }
20
- assert_response :success
21
- assert_equal 'ISO image', @response.body
34
+ perform_subnet_generate
22
35
  end
23
36
  end
24
37
  end