Showing with 43 additions and 41 deletions.
  1. +8 −0 CHANGELOG.md
  2. +28 −32 manifests/config.pp
  3. +1 −1 metadata.json
  4. +6 −8 spec/classes/init_spec.rb
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [4.1.0](https://github.com/theforeman/puppet-tftp/tree/4.1.0) (2018-05-02)

[Full Changelog](https://github.com/theforeman/puppet-tftp/compare/4.0.0...4.1.0)

**Merged pull requests:**

- Clean up the configuration class [\#70](https://github.com/theforeman/puppet-tftp/pull/70) ([ekohl](https://github.com/ekohl))

## [4.0.0](https://github.com/theforeman/puppet-tftp/tree/4.0.0) (2018-01-25)
[Full Changelog](https://github.com/theforeman/puppet-tftp/compare/3.0.2...4.0.0)

Expand Down
60 changes: 28 additions & 32 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
# Configure TFTP
class tftp::config {

case $::tftp::daemon {
default: {
if $tftp::manage_root_dir {
ensure_resource('file', $::tftp::root, {'ensure' => 'directory'})
}
if $::tftp::manage_root_dir {
ensure_resource('file', $::tftp::root, {'ensure' => 'directory'})
}

if $::osfamily =~ /^(FreeBSD|DragonFly)$/ {
augeas { 'set root directory':
context => '/files/etc/rc.conf',
changes => "set tftpd_flags '\"-s ${::tftp::root}\"'",
}
if $::tftp::daemon {
if $::osfamily =~ /^(FreeBSD|DragonFly)$/ {
augeas { 'set root directory':
context => '/files/etc/rc.conf',
changes => "set tftpd_flags '\"-s ${::tftp::root}\"'",
}
}
false: {
include ::xinetd
} else {
include ::xinetd

xinetd::service { 'tftp':
port => '69',
server => '/usr/sbin/in.tftpd',
server_args => "-v -s ${::tftp::root} -m /etc/tftpd.map",
socket_type => 'dgram',
protocol => 'udp',
cps => '100 2',
flags => 'IPv4',
per_source => '11',
}
xinetd::service { 'tftp':
port => '69',
server => '/usr/sbin/in.tftpd',
server_args => "-v -s ${::tftp::root} -m /etc/tftpd.map",
socket_type => 'dgram',
protocol => 'udp',
cps => '100 2',
flags => 'IPv4',
per_source => '11',
}

file {'/etc/tftpd.map':
source => "puppet:///modules/${module_name}/tftpd.map",
mode => '0644',
show_diff => false, # Puppet explodes with 'Error: invalid byte sequence in UTF-8' when trying to display the diff
notify => Class['xinetd'],
}
file {'/etc/tftpd.map':
source => "puppet:///modules/${module_name}/tftpd.map",
mode => '0644',
show_diff => false, # Puppet explodes with 'Error: invalid byte sequence in UTF-8' when trying to display the diff
notify => Class['xinetd'],
}

file { $::tftp::root:
ensure => directory,
notify => Class['xinetd'],
}
if $::tftp::manage_root_dir {
File[$::tftp::root] ~> Class['xinetd']
}
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-tftp",
"version": "4.0.0",
"version": "4.1.0",
"author": "theforeman",
"summary": "TFTP server configuration",
"license": "GPL-3.0+",
Expand Down
14 changes: 6 additions & 8 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@
:mode => '0644',
})

should contain_file('/var/lib/tftpboot').with({
:ensure => 'directory',
:notify => 'Class[Xinetd]',
})
should contain_file('/var/lib/tftpboot')
.with_ensure('directory')
.that_notifies('Class[Xinetd]')
end

it 'should not contain the service' do
Expand Down Expand Up @@ -197,10 +196,9 @@
:mode => '0644',
})

should contain_file('/var/lib/tftpboot').with({
:ensure => 'directory',
:notify => 'Class[Xinetd]',
})
should contain_file('/var/lib/tftpboot')
.with_ensure('directory')
.that_notifies('Class[Xinetd]')
end

it 'should not contain the service' do
Expand Down