foreman_bootdisk 4.0.0 → 4.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 +8 -0
- data/README.md +21 -18
- data/app/services/foreman_bootdisk/iso_generator.rb +10 -4
- data/lib/foreman_bootdisk/version.rb +1 -1
- data/lib/tasks/bootdisk.rake +18 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1efb079d68935777825c7c979322ded482808c4a
|
4
|
+
data.tar.gz: a01ad93b9680558aac5234bc7f9b1545076a22c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2866d33e1fdf7dfd4280aa0ddcc2306172e495a9a253eed2b889b030bce787209e0f5491546c95c6a39452fee6e1e468877b9ba335b1645b85f73c4e8d1c0a0e
|
7
|
+
data.tar.gz: be89f39658774049af6d8f62126e573b0f69bcedee8913a0d3caa35575a5d95f77a98495cbd694a06b69b414e3c91bba0bd1ec5d516dcb5bfb89c0cb0503b36e
|
data/CHANGES.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v4.0.1
|
4
|
+
* rake task accepts a dir for the output path, and falls back to a temporary
|
5
|
+
directory if the cwd is not writable (#7370)
|
6
|
+
|
3
7
|
## v4.0.0
|
4
8
|
* fix controller compatibility with Foreman 1.7
|
5
9
|
|
10
|
+
## v3.2.1
|
11
|
+
* fix empty? error when generating full host image on Ruby 1.8/1.9 (#7812,
|
12
|
+
Ronald van Zantvoort)
|
13
|
+
|
6
14
|
## v3.2.0
|
7
15
|
* add full host image containing OS bootloader for hosts that fail to
|
8
16
|
chainload with isolinux and iPXE (#7046)
|
data/README.md
CHANGED
@@ -133,12 +133,6 @@ instead of being stored in the image.
|
|
133
133
|
To generate the image from the web interface, view the host page, click the
|
134
134
|
"Boot disk" button and select "Host 'FQDN' image".
|
135
135
|
|
136
|
-
To generate from the command line on the Foreman server:
|
137
|
-
|
138
|
-
foreman-rake bootdisk:generate:host NAME=foo.example.com
|
139
|
-
|
140
|
-
Optionally set `OUTPUT=/path/foo.iso` to change the output destination.
|
141
|
-
|
142
136
|
To generate using the Hammer CLI, install the [hammer_cli_foreman_bootdisk](https://github.com/theforeman/hammer_cli_foreman_bootdisk)
|
143
137
|
plugin and run:
|
144
138
|
|
@@ -146,6 +140,13 @@ plugin and run:
|
|
146
140
|
|
147
141
|
See the hammer_cli_foreman_bootdisk documentation for more advanced usage.
|
148
142
|
|
143
|
+
To generate from the command line on the Foreman server:
|
144
|
+
|
145
|
+
foreman-rake bootdisk:generate:host NAME=foo.example.com OUTPUT=/tmp
|
146
|
+
|
147
|
+
Set `OUTPUT=/path` to change the output destination path (directory or file).
|
148
|
+
It must be writable by the 'foreman' user.
|
149
|
+
|
149
150
|
### Per-host full images
|
150
151
|
|
151
152
|
A variant of the per-host image, this version doesn't chainload from Foreman,
|
@@ -159,12 +160,6 @@ To generate the image from the web interface, view the host page, click the
|
|
159
160
|
a while to generate, as it downloads the OS bootloaders which can be
|
160
161
|
considerable in size.
|
161
162
|
|
162
|
-
To generate from the command line on the Foreman server:
|
163
|
-
|
164
|
-
foreman-rake bootdisk:generate:full_host NAME=foo.example.com
|
165
|
-
|
166
|
-
Optionally set `OUTPUT=/path/foo.iso` to change the output destination.
|
167
|
-
|
168
163
|
To generate using the Hammer CLI, install the [hammer_cli_foreman_bootdisk](https://github.com/theforeman/hammer_cli_foreman_bootdisk)
|
169
164
|
plugin and run:
|
170
165
|
|
@@ -172,6 +167,13 @@ plugin and run:
|
|
172
167
|
|
173
168
|
See the hammer_cli_foreman_bootdisk documentation for more advanced usage.
|
174
169
|
|
170
|
+
To generate from the command line on the Foreman server:
|
171
|
+
|
172
|
+
foreman-rake bootdisk:generate:full_host NAME=foo.example.com
|
173
|
+
|
174
|
+
Set `OUTPUT=/path` to change the output destination path (directory or file).
|
175
|
+
It must be writable by the 'foreman' user.
|
176
|
+
|
175
177
|
### Generic image
|
176
178
|
|
177
179
|
This provides a single ISO that can be used by all registered hosts, but since
|
@@ -186,12 +188,6 @@ address statically for the installed system via the kickstart file.
|
|
186
188
|
To generate the image from the web interface, view a host page, click the
|
187
189
|
"Boot disk" button and select "Generic image".
|
188
190
|
|
189
|
-
To generate from the command line on the Foreman server:
|
190
|
-
|
191
|
-
foreman-rake bootdisk:generate:generic
|
192
|
-
|
193
|
-
Optionally set `OUTPUT=/path/foo.iso` to change the output destination.
|
194
|
-
|
195
191
|
To generate using the Hammer CLI, install the [hammer_cli_foreman_bootdisk](https://github.com/theforeman/hammer_cli_foreman_bootdisk)
|
196
192
|
plugin and run:
|
197
193
|
|
@@ -199,6 +195,13 @@ plugin and run:
|
|
199
195
|
|
200
196
|
See the hammer_cli_foreman_bootdisk documentation for more advanced usage.
|
201
197
|
|
198
|
+
To generate from the command line on the Foreman server:
|
199
|
+
|
200
|
+
foreman-rake bootdisk:generate:generic
|
201
|
+
|
202
|
+
Set `OUTPUT=/path` to change the output destination path (directory or file).
|
203
|
+
It must be writable by the 'foreman' user.
|
204
|
+
|
202
205
|
### Host group images
|
203
206
|
|
204
207
|
TODO
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'tmpdir'
|
2
4
|
require 'uri'
|
3
5
|
|
4
6
|
# Generates an iPXE ISO hybrid image
|
5
7
|
#
|
6
8
|
# requires syslinux, ipxe/ipxe-bootimgs, genisoimage, isohybrid
|
7
9
|
class ForemanBootdisk::ISOGenerator
|
8
|
-
def self.generate_full_host(host, &block)
|
10
|
+
def self.generate_full_host(host, opts = {}, &block)
|
9
11
|
raise ::Foreman::Exception.new(N_('Host is not in build mode, so the template cannot be rendered')) unless host.build?
|
10
12
|
|
11
13
|
tmpl = host.send(:generate_pxe_template)
|
@@ -26,7 +28,7 @@ class ForemanBootdisk::ISOGenerator
|
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
|
-
generate(
|
31
|
+
generate(opts.merge(:isolinux => tmpl, :files => files), &block)
|
30
32
|
end
|
31
33
|
|
32
34
|
def self.generate(opts = {}, &block)
|
@@ -66,7 +68,11 @@ class ForemanBootdisk::ISOGenerator
|
|
66
68
|
end if opts[:files].respond_to? :each
|
67
69
|
end
|
68
70
|
|
69
|
-
iso =
|
71
|
+
iso = if opts[:dir]
|
72
|
+
Tempfile.new(['bootdisk', '.iso'], opts[:dir]).path
|
73
|
+
else
|
74
|
+
File.join(wd, 'output.iso')
|
75
|
+
end
|
70
76
|
unless system("#{Setting[:bootdisk_mkiso_command]} -o #{iso} -iso-level 2 -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table #{File.join(wd, 'build')}")
|
71
77
|
raise ::Foreman::Exception.new(N_("ISO build failed"))
|
72
78
|
end
|
@@ -105,7 +111,7 @@ class ForemanBootdisk::ISOGenerator
|
|
105
111
|
write_cache = use_cache
|
106
112
|
uri = URI(uri)
|
107
113
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
108
|
-
request = Net::HTTP::Get.new uri
|
114
|
+
request = Net::HTTP::Get.new uri.request_uri
|
109
115
|
|
110
116
|
http.request request do |response|
|
111
117
|
response.read_body do |chunk|
|
data/lib/tasks/bootdisk.rake
CHANGED
@@ -1,15 +1,26 @@
|
|
1
1
|
require 'date'
|
2
|
+
require 'tmpdir'
|
2
3
|
|
3
4
|
namespace :bootdisk do
|
5
|
+
def outputdir
|
6
|
+
if ENV['OUTPUT']
|
7
|
+
File.directory?(ENV['OUTPUT']) ? ENV['OUTPUT'] : File.dirname(ENV['OUTPUT'])
|
8
|
+
elsif File.writable?(Dir.pwd)
|
9
|
+
Dir.pwd
|
10
|
+
else
|
11
|
+
Dir.tmpdir
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
4
15
|
namespace :generate do
|
5
16
|
desc 'Generate a static boot disk for a specific host. NAME=fqdn, OUTPUT path'
|
6
17
|
task :host => :environment do
|
7
18
|
host = Host::Base.find_by_name(ENV['NAME']) || raise("cannot find host '#{ENV['NAME']}', specify NAME=fqdn")
|
8
19
|
tmpl = host.bootdisk_template_render
|
9
20
|
|
10
|
-
ForemanBootdisk::ISOGenerator.generate(:ipxe => tmpl) do |image|
|
11
|
-
output = ENV['OUTPUT'] || "#{host.name}.iso"
|
12
|
-
FileUtils.
|
21
|
+
ForemanBootdisk::ISOGenerator.generate(:ipxe => tmpl, :dir => outputdir) do |image|
|
22
|
+
output = ENV['OUTPUT'] || File.join(outputdir, "#{host.name}.iso")
|
23
|
+
FileUtils.mv image, output
|
13
24
|
puts "Wrote #{output}"
|
14
25
|
end
|
15
26
|
end
|
@@ -17,8 +28,8 @@ namespace :bootdisk do
|
|
17
28
|
desc 'Generate a full boot disk for a specific host with the OS bootloader included. NAME=fqdn, OUTPUT path'
|
18
29
|
task :full_host => :environment do
|
19
30
|
host = Host::Base.find_by_name(ENV['NAME']) || raise("cannot find host '#{ENV['NAME']}', specify NAME=fqdn")
|
20
|
-
ForemanBootdisk::ISOGenerator.generate_full_host(host) do |image|
|
21
|
-
output = ENV['OUTPUT'] || "#{host.name}_#{Date.today.strftime('%Y%m%d')}.iso"
|
31
|
+
ForemanBootdisk::ISOGenerator.generate_full_host(host, :dir => outputdir) do |image|
|
32
|
+
output = ENV['OUTPUT'] || File.join(outputdir, "#{host.name}_#{Date.today.strftime('%Y%m%d')}.iso")
|
22
33
|
FileUtils.cp image, output
|
23
34
|
puts "Wrote #{output}"
|
24
35
|
end
|
@@ -28,8 +39,8 @@ namespace :bootdisk do
|
|
28
39
|
task :generic => :environment do
|
29
40
|
tmpl = ForemanBootdisk::Renderer.new.generic_template_render
|
30
41
|
|
31
|
-
ForemanBootdisk::ISOGenerator.generate(:ipxe => tmpl) do |image|
|
32
|
-
output = ENV['OUTPUT'] || "bootdisk_#{URI.parse(Setting[:foreman_url]).host}.iso"
|
42
|
+
ForemanBootdisk::ISOGenerator.generate(:ipxe => tmpl, :dir => outputdir) do |image|
|
43
|
+
output = ENV['OUTPUT'] || File.join(outputdir, "bootdisk_#{URI.parse(Setting[:foreman_url]).host}.iso")
|
33
44
|
FileUtils.cp image, output
|
34
45
|
puts "Wrote #{output}"
|
35
46
|
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.0.
|
4
|
+
version: 4.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: 2014-
|
11
|
+
date: 2014-11-17 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.
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.0.6
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Create boot disks to provision hosts with Foreman
|