Skip to content

Commit a02f4bb

Browse files
author
Bastian Schmidt
committed
Fixes #35851 - Add parameter tftp system_image_root
1 parent f247991 commit a02f4bb

File tree

6 files changed

+26
-1
lines changed

6 files changed

+26
-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/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::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,
@@ -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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
end
3939
end
4040

41+
let(:system_image_root) { '/var/lib/foreman-proxy/tftp/system_images' }
42+
4143
puppetca_command = "#{puppet_path} cert *"
4244

4345
context 'without parameters' do
@@ -274,6 +276,7 @@
274276
'---',
275277
':enabled: false',
276278
":tftproot: #{tftp_root}",
279+
":system_image_root: #{system_image_root}"
277280
])
278281
end
279282

@@ -434,6 +437,7 @@
434437
'---',
435438
':enabled: https',
436439
":tftproot: #{tftp_root}",
440+
":system_image_root: #{system_image_root}"
437441
])
438442
end
439443

@@ -462,7 +466,8 @@
462466
'---',
463467
':enabled: https',
464468
':tftproot: /tftproot',
465-
':tftp_servername: 127.0.1.1'
469+
':tftp_servername: 127.0.1.1',
470+
':system_image_root: /var/lib/foreman-proxy/tftp/system_images}'
466471
])
467472
end
468473
end

spec/classes/foreman_proxy__tftp_spec.rb

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

1616
it { is_expected.to contain_class('foreman_proxy::tftp::netboot') }
1717

18+
system_image_root = '/var/lib/foreman-proxy/tftp/system_images'
1819
case facts[:osfamily]
1920
when 'Debian'
2021
tftp_root = '/srv/tftp'

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)