Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only install directories if tftp is managed #267

Merged
merged 1 commit into from
Sep 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Class['puppet::server::install'] -> Class['foreman_proxy::config']
}

if $foreman_proxy::tftp { include ::foreman_proxy::tftp }
if $foreman_proxy::tftp and $foreman_proxy::tftp_managed { include ::foreman_proxy::tftp }

# Somehow, calling these DHCP and DNS seems to conflict. So, they get a prefix...
if $foreman_proxy::dhcp and $foreman_proxy::dhcp_managed { include ::foreman_proxy::proxydhcp }
Expand Down
25 changes: 8 additions & 17 deletions manifests/tftp.pp
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
# Set up the tftp component
class foreman_proxy::tftp (
$tftp_managed = $foreman_proxy::tftp_managed,
) {
$required_tftp_classes = $tftp_managed ? {
true => Class['foreman_proxy::install', 'tftp::install'],
default => Class['foreman_proxy::install'],
class foreman_proxy::tftp {
class { '::tftp':
root => $foreman_proxy::tftp_root,
}

file{ $foreman_proxy::tftp_dirs:
file { $foreman_proxy::tftp_dirs:
ensure => directory,
owner => $foreman_proxy::user,
mode => '0644',
require => $required_tftp_classes,
recurse => true;
require => Class['foreman_proxy::install', 'tftp::install'],
recurse => true,
}

foreman_proxy::tftp::copy_file{$foreman_proxy::tftp_syslinux_filenames:
foreman_proxy::tftp::copy_file { $foreman_proxy::tftp_syslinux_filenames:
target_path => $foreman_proxy::tftp_root,
require => $required_tftp_classes;
require => Class['foreman_proxy::install', 'tftp::install'],
}

if $foreman_proxy::tftp_manage_wget {
ensure_packages(['wget'], { ensure => $foreman_proxy::ensure_packages_version, })
}

if $tftp_managed {
class { '::tftp':
root => $foreman_proxy::tftp_root,
}
}

case $::osfamily {
'RedHat': {
$osreleasemajor = regsubst($::operatingsystemrelease, '^(\d+)\..*$', '\1') # workaround for the possibly missing operatingsystemmajrelease
Expand Down
12 changes: 6 additions & 6 deletions spec/classes/foreman_proxy__config__spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

it { should compile.with_all_deps }

it 'should include tftp' do
it 'should include managed tftp' do
should contain_class('foreman_proxy::tftp')
should contain_class('tftp')
end
Expand Down Expand Up @@ -444,8 +444,8 @@
}'
end

it 'should include the foreman-proxy tftp class' do
should contain_class('foreman_proxy::tftp')
it 'should not include the foreman-proxy tftp class' do
should_not contain_class('foreman_proxy::tftp')
end

it 'should not include the ::tftp class' do
Expand All @@ -469,10 +469,10 @@
end
end

context 'with TFTP enabled and tftp_syslinux_filenames set' do
context 'with tftp_managed enabled and tftp_syslinux_filenames set' do
let :pre_condition do
'class {"foreman_proxy":
tftp => true,
tftp_managed => true,
tftp_syslinux_filenames => [ "/my/file", "/my/anotherfile" ],
}'
end
Expand All @@ -483,7 +483,7 @@
end
end

context 'with tftp_manage_wget disabled' do
context 'with tftp_managed enabled and tftp_manage_wget disabled' do
let :pre_condition do
'class {"foreman_proxy":
tftp_manage_wget => false,
Expand Down