foreman_bootdisk 2.0.4 → 2.0.5
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/CHANGES.md +3 -0
- data/app/models/concerns/bootdisk/host_ext.rb +16 -2
- data/app/services/bootdisk/renderer.rb +12 -2
- data/app/views/bootdisk/generic_host.erb +1 -1
- data/app/views/bootdisk/host.erb +6 -6
- data/lib/bootdisk/engine.rb +2 -0
- data/lib/bootdisk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e51cb397e2135c07a5e7d3964e190cefe4852e04
|
4
|
+
data.tar.gz: db451601c84e35db1492de7a5246fd4f8143c920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c750aeff74a5fb650288c67f540227ccaa765ef0544402fdf912de87fb9123fae5a547bf542a53171b25a1b68cb38692a070732fc6106cd2a4dea3b6c71d5dc
|
7
|
+
data.tar.gz: 72b036286e3d93af852e05fc2c5c56430037ecb50b15cba5b6d44ddfcf5274cf09cda537d19093305e1c68426fd7722396c24435423cd1ada301c48100cab631
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
1
3
|
module Bootdisk::HostExt
|
2
4
|
extend ActiveSupport::Concerns
|
3
5
|
|
@@ -6,10 +8,22 @@ module Bootdisk::HostExt
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def bootdisk_template_render
|
9
|
-
|
10
|
-
|
11
|
+
if (Gem::Version.new(SETTINGS[:version].notag) < Gem::Version.new('1.5')) && Setting[:safemode_render]
|
12
|
+
raise(::Foreman::Exception.new(N_('Bootdisk is not supported with safemode rendering, please disable safemode_render under Adminster>Settings')))
|
13
|
+
end
|
11
14
|
|
12
15
|
@host = self
|
13
16
|
pxe_render(bootdisk_template.template)
|
14
17
|
end
|
18
|
+
|
19
|
+
def bootdisk_chain_url(mac = self.mac, action = 'iPXE')
|
20
|
+
u = URI.parse(foreman_url(action))
|
21
|
+
u.query = "#{u.query}&mac=#{mac}"
|
22
|
+
u.fragment = nil
|
23
|
+
u.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def bootdisk_raise(*args)
|
27
|
+
raise ::Foreman::Exception.new(*args)
|
28
|
+
end
|
15
29
|
end
|
@@ -1,15 +1,25 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
1
3
|
module Bootdisk
|
2
4
|
class Renderer
|
3
5
|
include ::Foreman::Renderer
|
4
6
|
include Rails.application.routes.url_helpers
|
5
7
|
|
6
8
|
def generic_template_render
|
7
|
-
|
8
|
-
|
9
|
+
if (Gem::Version.new(SETTINGS[:version].notag) < Gem::Version.new('1.5')) && Setting[:safemode_render]
|
10
|
+
raise(::Foreman::Exception.new(N_('Bootdisk is not supported with safemode rendering, please disable safemode_render under Adminster>Settings')))
|
11
|
+
end
|
9
12
|
|
10
13
|
tmpl = ConfigTemplate.find_by_name(Setting[:bootdisk_generic_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_generic_host_template'))
|
11
14
|
@host = Struct.new(:token).new(nil)
|
12
15
|
unattended_render(tmpl.template)
|
13
16
|
end
|
17
|
+
|
18
|
+
def bootdisk_chain_url(action = 'iPXE')
|
19
|
+
u = URI.parse(foreman_url(action))
|
20
|
+
u.query = "#{u.query}&mac="
|
21
|
+
u.fragment = nil
|
22
|
+
u.to_s
|
23
|
+
end
|
14
24
|
end
|
15
25
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
isset ${net<%= i -%>/mac} || goto no_nic
|
16
16
|
echo net<%= i -%> is a ${net<%= i -%>/chip} with MAC ${net<%= i -%>/mac}
|
17
17
|
dhcp net<%= i %> || goto net<%= i+1 %>
|
18
|
-
chain <%=
|
18
|
+
chain <%= bootdisk_chain_url %>${net<%= i -%>/mac} || goto net<%= i+1 %>
|
19
19
|
exit 0
|
20
20
|
<% end -%>
|
21
21
|
|
data/app/views/bootdisk/host.erb
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
# Copy this template to customize it, the original is read-only.
|
6
6
|
|
7
7
|
<%
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
bootdisk_raise(N_('Host has no IP address defined')) if @host.ip.empty?
|
9
|
+
bootdisk_raise(N_('Host has no subnet defined')) unless @host.subnet
|
10
|
+
bootdisk_raise(N_('Host has no domain defined')) unless @host.domain
|
11
|
+
bootdisk_raise(N_('Subnet (%s) has no gateway defined'), @host.subnet) if @host.subnet.gateway.empty?
|
12
|
+
bootdisk_raise(N_('Subnet (%s) has no primary DNS server defined'), @host.subnet) if @host.subnet.dns_primary.empty?
|
13
13
|
%>
|
14
14
|
|
15
15
|
# loop over net* until the host's MAC matches
|
@@ -37,7 +37,7 @@ set domain <%= @host.domain.to_s %>
|
|
37
37
|
|
38
38
|
# Chainload from Foreman rather than embedding OS info here, so the behaviour
|
39
39
|
# is entirely dynamic.
|
40
|
-
chain <%=
|
40
|
+
chain <%= bootdisk_chain_url %>
|
41
41
|
exit 0
|
42
42
|
|
43
43
|
:no_nic
|
data/lib/bootdisk/engine.rb
CHANGED
data/lib/bootdisk/version.rb
CHANGED
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: 2.0.
|
4
|
+
version: 2.0.5
|
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-05-02 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.
|