Skip to content

Commit 3d479a4

Browse files
committed
Fixes #38558 - support for configuring WOL module
1 parent 6315c34 commit 3d479a4

File tree

5 files changed

+51
-1
lines changed

5 files changed

+51
-1
lines changed

manifests/config.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565

6666
contain foreman_proxy::module::bmc
6767

68+
contain foreman_proxy::module::wol
69+
6870
contain foreman_proxy::module::dhcp
6971
foreman_proxy::provider { ['dhcp_isc', 'dhcp_libvirt']:
7072
}

manifests/init.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@
219219
#
220220
# $bmc_ssh_poweron:: BMC SSH poweron command.
221221
#
222+
# $wol:: Enable WOL feature
223+
#
224+
# $wol_listen_on:: WOL proxy to listen on https, http, or both
225+
#
222226
# $keyfile:: DNS server keyfile path
223227
#
224228
# $realm:: Enable realm management feature
@@ -404,6 +408,8 @@
404408
# lint:ignore:quoted_booleans
405409
String $bmc_ssh_poweron = 'false',
406410
# lint:endignore
411+
Boolean $wol = false,
412+
Foreman_proxy::ListenOn $wol_listen_on = 'https',
407413
Boolean $realm = false,
408414
Foreman_proxy::ListenOn $realm_listen_on = 'https',
409415
String $realm_provider = 'freeipa',

manifests/module/wol.pp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# @summary The built in WOL module
2+
#
3+
# @param enabled
4+
# Whether the module is enabled or disabled.
5+
#
6+
# @param listen_on
7+
# Where to listen on.
8+
class foreman_proxy::module::wol (
9+
Boolean $enabled = $foreman_proxy::wol,
10+
Foreman_proxy::ListenOn $listen_on = $foreman_proxy::wol_listen_on,
11+
) {
12+
foreman_proxy::module { 'wol':
13+
enabled => $enabled,
14+
feature => 'WOL',
15+
listen_on => $listen_on,
16+
}
17+
}

spec/classes/foreman_proxy__spec.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
'logs', 'httpboot', 'puppet', 'puppet_proxy_puppet_api',
9797
'puppetca', 'puppetca_http_api', 'puppetca_puppet_cert',
9898
'puppetca_hostname_whitelisting', 'puppetca_token_whitelisting',
99-
'realm', 'templates', 'tftp'
99+
'realm', 'templates', 'tftp', 'wol'
100100
].each do |cfile|
101101
should contain_file("#{etc_dir}/foreman-proxy/settings.d/#{cfile}.yml")
102102
.with_owner('root')
@@ -151,6 +151,13 @@
151151
])
152152
end
153153

154+
it 'should generate correct wol.yml' do
155+
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/wol.yml", [
156+
'---',
157+
':enabled: false',
158+
])
159+
end
160+
154161
it 'should generate correct dhcp.yml' do
155162
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/dhcp.yml", [
156163
'---',
@@ -536,6 +543,17 @@
536543
end
537544
end
538545

546+
context 'with wol' do
547+
let(:params) { super().merge(wol: true) }
548+
549+
it 'should enable wol' do
550+
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/wol.yml", [
551+
'---',
552+
':enabled: https',
553+
])
554+
end
555+
end
556+
539557
context 'only http enabled' do
540558
let(:params) { super().merge(ssl: false, http: true) }
541559

templates/wol.yml.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# Can be true, false, or http/https to enable just one of the protocols
3+
:enabled: <%= @module_enabled %>
4+
5+
# Wake-on-LAN configuration
6+
# The module sends standard WoL magic packets via UDP broadcast on port 9
7+
# No additional configuration is required as it uses the standard protocol

0 commit comments

Comments
 (0)