Showing with 49 additions and 20 deletions.
  1. +1 −14 .travis.yml
  2. +17 −0 CHANGELOG.md
  3. +1 −1 Gemfile
  4. +1 −0 manifests/init.pp
  5. +2 −4 metadata.json
  6. +22 −0 spec/classes/init_spec.rb
  7. +5 −1 templates/dhcpd.conf.erb
15 changes: 1 addition & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
---
# This file is managed centrally by modulesync
# https://github.com/theforeman/foreman-installer-modulesync
rvm:
- 2.1.9
- 2.3.0
- 2.4.1
env:
matrix:
- PUPPET_VERSION=4.9
matrix:
fast_finish: true
include:
- rvm: 2.4.1
env: PUPPET_VERSION=5.0
- rvm: 2.5.1
env: PUPPET_VERSION=5.0
- rvm: 2.5.1
env: PUPPET_VERSION=6.0
# Acceptance tests
Expand Down Expand Up @@ -85,8 +76,4 @@ matrix:
- sudo service docker restart

bundler_args: --without system_tests development
before_install:
- if [ $TRAVIS_RUBY_VERSION = 2.1.9 ] ; then
gem install -v 1.17.3 bundler --no-rdoc --no-ri;
fi
sudo: false
dist: xenial
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## [5.0.0](https://github.com/theforeman/puppet-dhcp/tree/5.0.0) (2019-04-15)

[Full Changelog](https://github.com/theforeman/puppet-dhcp/compare/4.3.0...5.0.0)

**Breaking changes:**

- drop Puppet 4 [\#152](https://github.com/theforeman/puppet-dhcp/pull/152) ([mmoll](https://github.com/mmoll))
- drop EOL OSes [\#151](https://github.com/theforeman/puppet-dhcp/pull/151) ([mmoll](https://github.com/mmoll))

**Implemented enhancements:**

- Make the config header configurable [\#149](https://github.com/theforeman/puppet-dhcp/pull/149) ([ekohl](https://github.com/ekohl))

**Fixed bugs:**

- fix missing authoritative statement [\#147](https://github.com/theforeman/puppet-dhcp/pull/147) ([qs5779](https://github.com/qs5779))

## [4.3.0](https://github.com/theforeman/puppet-dhcp/tree/4.3.0) (2019-01-10)

[Full Changelog](https://github.com/theforeman/puppet-dhcp/compare/4.2.0...4.3.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

source 'https://rubygems.org'

gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 4.6'
gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 5.5'

gem 'rake'
gem 'rspec', '~> 3.0'
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
Hash[String, Hash] $pools = {},
Hash[String, Hash] $hosts = {},
Variant[Array[String], Optional[String]] $includes = undef,
String $config_comment = 'dhcpd.conf',
) inherits dhcp::params {

# In case people set interface instead of interfaces work around
Expand Down
6 changes: 2 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-dhcp",
"version": "4.3.0",
"version": "5.0.0",
"author": "theforeman",
"summary": "Manage the ISC DHCP daemon",
"license": "Apache-2.0",
Expand Down Expand Up @@ -31,7 +31,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.6.1 < 7.0.0"
"version_requirement": ">= 5.5.8 < 7.0.0"
}
],
"operatingsystem_support": [
Expand Down Expand Up @@ -72,7 +72,6 @@
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"14.04",
"16.04",
"18.04"
]
Expand All @@ -83,7 +82,6 @@
{
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"10",
"11",
"12"
]
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'omapi-port 7911;',
'default-lease-time 43200;',
'max-lease-time 86400;',
'not authoritative;',
'ddns-update-style none;',
'option domain-name "example.com";',
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
Expand Down Expand Up @@ -172,6 +173,7 @@
'omapi-port 7911;',
'default-lease-time 43200;',
'max-lease-time 86400;',
'not authoritative;',
'ddns-updates on;',
'ddns-update-style interim;',
'update-static-leases on;',
Expand Down Expand Up @@ -204,6 +206,7 @@
verify_concat_fragment_exact_contents(catalogue, 'dhcp.conf+01_main.dhcp', [
'default-lease-time 43200;',
'max-lease-time 86400;',
'not authoritative;',
'ddns-update-style none;',
'option domain-name "example.com";',
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
Expand Down Expand Up @@ -231,6 +234,7 @@
'omapi-port 7911;',
'default-lease-time 43200;',
'max-lease-time 86400;',
'not authoritative;',
'ddns-update-style none;',
'option domain-name "example.com";',
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
Expand All @@ -257,6 +261,7 @@
'omapi-port 7911;',
'default-lease-time 43200;',
'max-lease-time 86400;',
'not authoritative;',
'ddns-update-style none;',
'option domain-name "example.com";',
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
Expand Down Expand Up @@ -284,6 +289,7 @@
'omapi-port 7911;',
'default-lease-time 43200;',
'max-lease-time 86400;',
'not authoritative;',
'ddns-update-style none;',
'option domain-name "example.com";',
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
Expand Down Expand Up @@ -312,6 +318,7 @@
'omapi-port 7911;',
'default-lease-time 43200;',
'max-lease-time 86400;',
'not authoritative;',
'ddns-update-style none;',
'option domain-name "example.com";',
'option domain-name-servers 8.8.8.8, 8.8.4.4;',
Expand All @@ -325,6 +332,21 @@
])
}
end

describe "with config_comment" do
context 'with multiple lines' do
let(:overridden_params) do {
:config_comment => "first line\nsecond line"
} end

it do
verify_concat_fragment_contents(catalogue, 'dhcp.conf+01_main.dhcp', [
'# first line',
'# second line',
])
end
end
end
end
end
end
6 changes: 5 additions & 1 deletion templates/dhcpd.conf.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# dhcpd.conf
<% @config_comment.split("\n").each do |line| -%>
<%= "# #{line}" %>
<% end -%>
<% if @omapi -%>
omapi-port 7911;
<% if @omapi_name && @omapi_key && !@omapi_key.empty? -%>
Expand All @@ -17,6 +19,8 @@ max-lease-time <%= @max_lease_time %>;
# Make the server authoritative for the network segments that
# are configured, and tell it to send DHCPNAKs to bogus requests
authoritative;
<% else %>
not authoritative;
<% end -%>
<% if (@dnsupdatekey && !@dnsupdatekey.empty?) || @ddns_updates -%>
Expand Down