1 change: 0 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ fixtures:
repositories:
augeas_core: 'https://github.com/puppetlabs/puppetlabs-augeas_core'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
xinetd: 'https://github.com/puppetlabs/puppetlabs-xinetd'
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Changelog

## [7.2.0](https://github.com/theforeman/puppet-tftp/tree/7.2.0) (2022-04-19)
## [8.0.0](https://github.com/theforeman/puppet-tftp/tree/8.0.0) (2022-10-27)

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

**Breaking changes:**

- Drop xinetd support [\#136](https://github.com/theforeman/puppet-tftp/pull/136) ([ekohl](https://github.com/ekohl))

**Implemented enhancements:**

- Update to voxpupuli-test 5 [\#135](https://github.com/theforeman/puppet-tftp/pull/135) ([ekohl](https://github.com/ekohl))

## [7.2.0](https://github.com/theforeman/puppet-tftp/tree/7.2.0) (2022-04-20)

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

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem 'puppet-lint-param-docs', '>= 1.3.0', {"groups"=>["test"]}
gem 'puppet-lint-spaceship_operator_without_tag-check', {"groups"=>["test"]}
gem 'puppet-lint-strict_indent-check', {"groups"=>["test"]}
gem 'puppet-lint-undef_in_function-check', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 1.4', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 5.0', {"groups"=>["test"]}
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet_metadata', '~> 1.3'
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
Expand Down
2 changes: 1 addition & 1 deletion data/Amazon.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tftp::daemon: false
tftp::package: tftp-server
tftp::root: "/var/lib/tftpboot"
tftp::service: tftp.socket
tftp::syslinux_package: syslinux
1 change: 0 additions & 1 deletion data/Archlinux.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
tftp::daemon: true
tftp::package: tftp-hpa
tftp::root: "/srv/tftp"
tftp::service: tftpd.socket
Expand Down
2 changes: 0 additions & 2 deletions data/CentOS-7.yaml

This file was deleted.

1 change: 0 additions & 1 deletion data/Debian.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
tftp::daemon: true
tftp::package: tftpd-hpa
tftp::root: "/srv/tftp"
tftp::service: tftpd-hpa
Expand Down
1 change: 0 additions & 1 deletion data/DragonFly.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
tftp::daemon: true
tftp::package: tftp-hpa
tftp::root: "/tftpboot"
tftp::service: tftpd
Expand Down
1 change: 0 additions & 1 deletion data/FreeBSD.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
tftp::daemon: true
tftp::package: tftp-hpa
tftp::root: "/tftpboot"
tftp::service: tftpd
Expand Down
2 changes: 0 additions & 2 deletions data/RedHat-7.yaml

This file was deleted.

1 change: 0 additions & 1 deletion data/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
tftp::daemon: true
tftp::service: tftp.socket
tftp::package: tftp-server
tftp::root: "/var/lib/tftpboot"
Expand Down
2 changes: 0 additions & 2 deletions data/Scientific-7.yaml

This file was deleted.

1 change: 0 additions & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
tftp::manage_root_dir: true
tftp::map_source: puppet:///modules/tftp/tftpd.map
5 changes: 0 additions & 5 deletions files/tftpd.map

This file was deleted.

36 changes: 5 additions & 31 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,13 @@
# @api private
class tftp::config {
if $tftp::manage_root_dir {
ensure_resource('file', $tftp::root, {'ensure' => 'directory'})
ensure_resource('file', $tftp::root, { 'ensure' => 'directory' })
}

if $tftp::daemon {
if $facts['os']['family'] =~ /^(FreeBSD|DragonFly)$/ {
augeas { 'set root directory':
context => '/files/etc/rc.conf',
changes => "set tftpd_flags '\"-s ${tftp::root}\"'",
}
}
} 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',
}

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

if $tftp::manage_root_dir {
File[$tftp::root] ~> Class['xinetd']
if $facts['os']['family'] =~ /^(FreeBSD|DragonFly)$/ {
augeas { 'set root directory':
context => '/files/etc/rc.conf',
changes => "set tftpd_flags '\"-s ${tftp::root}\"'",
}
}
}
9 changes: 0 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# TFTP server class
#
# This class installs and configures a TFTP server, supporting both standalone
# daemons and xinetd-based TFTP servers.
#
# @summary Installs and configures a TFTP server
#
# @example Simple usage
Expand All @@ -21,18 +16,14 @@
# @param root Configures the root directory for the TFTP server
# @param package Name of the TFTP server package
# @param syslinux_package Name of the syslinux package, essential for pxe boot
# @param daemon Runs a TFTP service when true, configures xinetd when false
# @param manage_root_dir manages the root dir, which tftpd will serve, defaults to true
# @param map_source The source URL of the mapping file
# @param service Name of the TFTP service, when daemon is true
# @param service_provider Override TFTP service provider, when daemon is true
class tftp (
Stdlib::Absolutepath $root,
String $package,
Variant[String, Array[String]] $syslinux_package,
Boolean $daemon,
Boolean $manage_root_dir,
String $map_source,
Optional[String] $service = undef,
Optional[String] $service_provider = undef,
) {
Expand Down
14 changes: 5 additions & 9 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# TFTP service
# @api private
class tftp::service {

# No service needed if not daemonized
if $tftp::daemon {
service { $tftp::service:
ensure => running,
enable => true,
alias => 'tftpd',
provider => $tftp::service_provider,
}
service { $tftp::service:
ensure => running,
enable => true,
alias => 'tftpd',
provider => $tftp::service_provider,
}
}
9 changes: 2 additions & 7 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-tftp",
"version": "7.2.0",
"version": "8.0.0",
"author": "theforeman",
"summary": "TFTP server configuration",
"license": "GPL-3.0+",
Expand All @@ -10,17 +10,12 @@
"description": "Module for configuring a TFTP server",
"tags": [
"foreman",
"tftp",
"xinetd"
"tftp"
],
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.13.1 < 9.0.0"
},
{
"name": "puppetlabs/xinetd",
"version_requirement": ">= 1.1.0 < 4.0.0"
}
],
"requirements": [
Expand Down
52 changes: 0 additions & 52 deletions spec/acceptance/tftp_redhat_spec.rb

This file was deleted.

15 changes: 1 addition & 14 deletions spec/acceptance/tftp_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
require 'spec_helper_acceptance'

describe 'tftp with default parameters' do
before(:all) do
on hosts, puppet('resource', 'service', 'xinetd', 'ensure=stopped', 'enable=false')
end

after(:all) do
on hosts, puppet('resource', 'service', 'xinetd', 'ensure=stopped', 'enable=false')
end

it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
Expand All @@ -26,7 +18,7 @@ class { 'tftp': }
when 'Archlinux'
'tftpd.socket'
when 'RedHat'
fact('operatingsystemmajrelease').to_i >= 8 ? 'tftp.socket' : 'xinetd'
'tftp.socket'
when 'Debian'
'tftpd-hpa'
end
Expand All @@ -36,11 +28,6 @@ class { 'tftp': }
it { is_expected.to be_running }
end

describe service('xinetd'), if: service_name != 'xinetd' do
it { is_expected.not_to be_enabled }
it { is_expected.not_to be_running }
end

describe port(69), unless: service_name.end_with?('.socket') do
it { is_expected.to be_listening.with('udp') }
end
Expand Down
Loading