Skip to content

Commit a3883c8

Browse files
Bastian Schmidtekohl
andcommitted
Fixes #35851 - Add parameter tftp system_image_root
Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
1 parent f247991 commit a3883c8

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@
111111
#
112112
# $tftp_replace_grub2_cfg:: Determines if grub2.cfg will be replaced
113113
#
114+
# $system_image_root:: TFTP system image root directory
115+
#
114116
# $dhcp:: Enable DHCP feature
115117
#
116118
# $dhcp_listen_on:: DHCP proxy to listen on https, http, or both
@@ -334,6 +336,7 @@
334336
Boolean $tftp_managed = true,
335337
Boolean $tftp_manage_wget = true,
336338
Optional[Stdlib::Absolutepath] $tftp_root = $foreman_proxy::params::tftp_root,
339+
Optional[Stdlib::Absolutepath] $system_image_root = $foreman_proxy::params::system_image_root,
337340
Optional[Array[Stdlib::Absolutepath]] $tftp_dirs = undef,
338341
Optional[String] $tftp_servername = undef,
339342
Boolean $tftp_replace_grub2_cfg = false,

manifests/module/tftp.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
#
99
# @param tftproot
1010
# The root directory to use. This is required if the module is enabled.
11+
#
12+
# @param system_image_root
13+
# The system image root directory to use. This is required if the module
14+
# is supposed to download and extract OS image files.
1115
class foreman_proxy::module::tftp (
1216
Boolean $enabled = $foreman_proxy::tftp,
1317
Foreman_proxy::ListenOn $listen_on = $foreman_proxy::tftp_listen_on,
1418
Optional[Stdlib::Absolutepath] $tftproot = $foreman_proxy::tftp_root,
19+
Optional[Stdlib::Absolutepath] $system_image_root = $foreman_proxy::system_image_root,
1520
) {
1621
if $enabled {
1722
assert_type(NotUndef, $tftproot)
23+
assert_type(NotUndef, $system_image_root)
1824
}
1925

2026
foreman_proxy::module { 'tftp':

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141

142142
# TFTP settings - requires optional TFTP puppet module
143143
$tftp_root = lookup('tftp::root', undef, undef, undef)
144+
$system_image_root = '/var/lib/foreman-proxy/tftp/system_images'
144145

145146
# DHCP settings - requires optional DHCP puppet module
146147
$dhcp_interface = pick(fact('networking.primary'), 'eth0')

manifests/tftp.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
class foreman_proxy::tftp (
44
String[1] $user = $foreman_proxy::user,
55
Optional[Stdlib::Absolutepath] $root = $foreman_proxy::tftp_root,
6+
Optional[Stdlib::Absolutepath] $system_image_root = $foreman_proxy::system_image_root,
67
Optional[Array[Stdlib::Absolutepath]] $directories = $foreman_proxy::tftp_dirs,
78
Array[Stdlib::Absolutepath] $syslinux_filenames = $foreman_proxy::params::tftp_syslinux_filenames,
89
Boolean $manage_wget = $foreman_proxy::tftp_manage_wget,
@@ -24,6 +25,12 @@
2425
recurse => true,
2526
}
2627

28+
file { $system_image_root:
29+
ensure => directory,
30+
owner => $user,
31+
mode => '0644',
32+
}
33+
2734
file { "${tftp::root}/grub2/grub.cfg":
2835
ensure => file,
2936
owner => $user,

spec/classes/foreman_proxy__spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
'---',
275275
':enabled: false',
276276
":tftproot: #{tftp_root}",
277+
':system_image_root: /var/lib/foreman-proxy/tftp/system_images',
277278
])
278279
end
279280

@@ -434,6 +435,7 @@
434435
'---',
435436
':enabled: https',
436437
":tftproot: #{tftp_root}",
438+
':system_image_root: /var/lib/foreman-proxy/tftp/system_images',
437439
])
438440
end
439441

@@ -462,7 +464,8 @@
462464
'---',
463465
':enabled: https',
464466
':tftproot: /tftproot',
465-
':tftp_servername: 127.0.1.1'
467+
':tftp_servername: 127.0.1.1',
468+
':system_image_root: /var/lib/foreman-proxy/tftp/system_images',
466469
])
467470
end
468471
end

templates/tftp.yml.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
# Defines the default certificate action for certificate checking.
1414
# When false, the argument --no-check-certificate will be used.
1515
#:verify_server_cert: true
16+
17+
# Defines the default folder to provide system images.
18+
:system_image_root: <%= scope.lookupvar("foreman_proxy::module::tftp::system_image_root") %>

0 commit comments

Comments
 (0)