Skip to content

Commit 4f510ef

Browse files
Bastian Schmidtekohl
andcommitted
Fixes #35851 - Add parameter tftp_system_image_root
Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
1 parent 4e862c2 commit 4f510ef

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
#
121121
# $tftp_replace_grub2_cfg:: Determines if grub2.cfg will be replaced
122122
#
123+
# $tftp_system_image_root:: TFTP system image root directory
124+
#
123125
# $dhcp:: Enable DHCP feature
124126
#
125127
# $dhcp_listen_on:: DHCP proxy to listen on https, http, or both
@@ -345,6 +347,7 @@
345347
Boolean $tftp_managed = true,
346348
Boolean $tftp_manage_wget = true,
347349
Optional[Stdlib::Absolutepath] $tftp_root = $foreman_proxy::params::tftp_root,
350+
Optional[Stdlib::Absolutepath] $tftp_system_image_root = $foreman_proxy::params::tftp_system_image_root,
348351
Optional[Array[Stdlib::Absolutepath]] $tftp_dirs = undef,
349352
Optional[String] $tftp_servername = undef,
350353
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 tftp_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] $tftp_system_image_root = $foreman_proxy::tftp_system_image_root,
1520
) {
1621
if $enabled {
1722
assert_type(NotUndef, $tftproot)
23+
assert_type(NotUndef, $tftp_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
@@ -158,6 +158,7 @@
158158

159159
# TFTP settings - requires optional TFTP puppet module
160160
$tftp_root = lookup('tftp::root', undef, undef, undef)
161+
$tftp_system_image_root = '/var/lib/foreman-proxy/tftp/system_images'
161162

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

manifests/tftp.pp

Lines changed: 1 addition & 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] $tftp_system_image_root = $foreman_proxy::tftp_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,

spec/classes/foreman_proxy__spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@
278278
'---',
279279
':enabled: false',
280280
":tftproot: #{tftp_root}",
281+
':tftp_system_image_root: /var/lib/foreman-proxy/tftp/system_images',
281282
])
282283
end
283284

@@ -458,6 +459,7 @@
458459
'---',
459460
':enabled: https',
460461
":tftproot: #{tftp_root}",
462+
':tftp_system_image_root: /var/lib/foreman-proxy/tftp/system_images',
461463
])
462464
end
463465

@@ -486,7 +488,8 @@
486488
'---',
487489
':enabled: https',
488490
':tftproot: /tftproot',
489-
':tftp_servername: 127.0.1.1'
491+
':tftp_servername: 127.0.1.1',
492+
':tftp_system_image_root: /var/lib/foreman-proxy/tftp/system_images',
490493
])
491494
end
492495
end

templates/tftp.yml.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
:tftproot: <%= scope.lookupvar("foreman_proxy::module::tftp::tftproot") %>
55
# Defines the TFTP Servername to use, overrides the name in the subnet declaration
66
<%= '#' if [nil, :undefined, :undef].include?(scope.lookupvar("foreman_proxy::tftp_servername")) %>:tftp_servername: <%= scope.lookupvar("foreman_proxy::tftp_servername") %>
7+
8+
# Defines the default folder to provide system images.
9+
:tftp_system_image_root: <%= scope.lookupvar("foreman_proxy::module::tftp::tftp_system_image_root") %>

0 commit comments

Comments
 (0)