3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
fixtures:
repositories:
augeas_core:
repo: 'https://github.com/puppetlabs/puppetlabs-augeas_core'
puppet_version: '>= 6.0.0'
concat: 'https://github.com/puppetlabs/puppetlabs-concat'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
systemd: 'https://github.com/camptocamp/puppet-systemd'
66 changes: 60 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,78 @@ matrix:
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
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker\,hostname=centos7-64.example.com}
env:
- BEAKER_PUPPET_COLLECTION=puppet5
- BEAKER_setfile=centos7-64{hostname=centos7-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

- rvm: 2.5.1
env:
- BEAKER_PUPPET_COLLECTION=puppet6
- BEAKER_setfile=centos7-64{hostname=centos7-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

- rvm: 2.5.1
env:
- BEAKER_PUPPET_COLLECTION=puppet5
- BEAKER_setfile=debian8-64{hostname=debian8-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

- rvm: 2.5.1
env:
- BEAKER_PUPPET_COLLECTION=puppet6
- BEAKER_setfile=debian8-64{hostname=debian8-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker\,hostname=debian8-64.example.com}
env:
- BEAKER_PUPPET_COLLECTION=puppet5
- BEAKER_setfile=debian9-64{hostname=debian9-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker\,hostname=debian9-64.example.com}
env:
- BEAKER_PUPPET_COLLECTION=puppet6
- BEAKER_setfile=debian9-64{hostname=debian9-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- 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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [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)

**Implemented enhancements:**

- update FreeBSD pkg name and support 12.x [\#144](https://github.com/theforeman/puppet-dhcp/pull/144) ([mmoll](https://github.com/mmoll))
- Create some puppet-strings documentation [\#143](https://github.com/theforeman/puppet-dhcp/pull/143) ([ekohl](https://github.com/ekohl))
- Support Puppet 6 [\#141](https://github.com/theforeman/puppet-dhcp/pull/141) ([ekohl](https://github.com/ekohl))

## [4.2.0](https://github.com/theforeman/puppet-dhcp/tree/4.2.0) (2018-10-04)

[Full Changelog](https://github.com/theforeman/puppet-dhcp/compare/4.1.1...4.2.0)
Expand Down
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ gem 'rspec-puppet', '~> 2.3'
gem 'rspec-puppet-facts', '>= 1.7'
gem 'puppetlabs_spec_helper', '>= 2.1.1'
gem 'puppet-lint', '>= 2'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-classes_and_types_beginning_with_digits-check'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
Expand All @@ -26,9 +25,9 @@ gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-version_comparison-check'
gem 'simplecov'
gem 'github_changelog_generator', {"git"=>"https://github.com/skywinder/github-changelog-generator", "ref"=>"20ee04ba1234e9e83eb2ffb5056e23d641c7a018", "groups"=>["development"]}
gem 'github_changelog_generator', {"git"=>"https://github.com/skywinder/github-changelog-generator", "ref"=>"20ee04ba1234e9e83eb2ffb5056e23d641c7a018", "groups"=>["development"]} if RUBY_VERSION >= '2.2.2'
gem 'puppet-blacksmith', '>= 4.1.0', {"groups"=>["development"]}
gem 'beaker', '>= 4.0.0', {"groups"=>["system_tests"]}
gem 'beaker', '>= 4.2.0', {"groups"=>["system_tests"]}
gem 'beaker-docker', {"groups"=>["system_tests"]}
gem 'beaker-hostgenerator', '>= 1.1.10', {"groups"=>["system_tests"]}
gem 'beaker-puppet', {"groups"=>["system_tests"]}
Expand All @@ -37,7 +36,6 @@ gem 'beaker-module_install_helper', {"groups"=>["system_tests"]}
gem 'beaker-puppet_install_helper', {"groups"=>["system_tests"]}
gem 'metadata-json-lint'
gem 'kafo_module_lint'
gem 'rgen'
gem 'parallel_tests'

# vim:ft=ruby
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Puppet Forge](https://img.shields.io/puppetforge/v/theforeman/dhcp.svg)](https://forge.puppetlabs.com/theforeman/dhcp)
[![Build Status](https://travis-ci.org/theforeman/puppet-dhcp.svg?branch=master)](https://travis-ci.org/theforeman/puppet-dhcp)

# DHCP module for Puppet

DHCP module for theforeman. Based on original DHCP module by ZLeslie, thanks
Expand Down Expand Up @@ -87,7 +90,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
8 changes: 4 additions & 4 deletions examples/init.pp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
$ddnskeyname = 'dhcp_updater'

class { '::dhcp':
class { 'dhcp':
dnsdomain => [
'example.com',
'1.1.10.in-addr.arpa',
],
nameservers => ['10.1.1.10'],
interfaces => ['eth0'],
dnsupdatekey => "/etc/bind/keys.d/${::ddnskeyname}",
require => Bind::Key[$::ddnskeyname],
dnsupdatekey => "/etc/bind/keys.d/${ddnskeyname}",
require => Bind::Key[$ddnskeyname],
pxeserver => '10.1.1.5',
pxefilename => 'pxelinux.0',
}

class { '::dhcp::failover':
class { 'dhcp::failover':
role => 'primary',
peer_address => '10.1.1.20',
}
Expand Down
8 changes: 7 additions & 1 deletion manifests/dhcp_class.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Define a DHCP class
#
# @param parameters
# The parameters for the class definition. When specified as a string, it
# will be used verbatim with a semi colon at the end. When specified as an
# array, every string is used and appended with a semi colon.
define dhcp::dhcp_class (
Variant[Array[String], String] $parameters,
) {
concat::fragment { "dhcp.conf+50_${name}.dhcp":
target => "${::dhcp::dhcp_dir}/dhcpd.conf",
target => "${dhcp::dhcp_dir}/dhcpd.conf",
content => template('dhcp/dhcpd.class.erb'),
order => "50-${name}",
}
Expand Down
8 changes: 3 additions & 5 deletions manifests/disable.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# ----------
# Remove and Disable the DHCP server
# ----------
class dhcp::disable {
include ::dhcp::params
include dhcp::params

$packagename = $::dhcp::params::packagename
$servicename = $::dhcp::params::servicename
$packagename = $dhcp::params::packagename
$servicename = $dhcp::params::servicename

package { $packagename:
ensure => absent,
Expand Down
10 changes: 7 additions & 3 deletions manifests/failover.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Define a failover peer
#
# @param peer_address
# The address of the failover peer.
class dhcp::failover (
String $peer_address,
Enum['primary', 'secondary'] $role = 'primary',
String $address = $::ipaddress,
String $address = $facts['ipaddress'],
Variant[Integer[0, 65535], String] $port = 519,
Variant[Integer[0], String] $max_response_delay = 30,
Variant[Integer[0], String] $max_unacked_updates = 10,
Expand All @@ -11,10 +15,10 @@
Optional[String] $omapi_key = undef,
) {

include ::dhcp
include dhcp

concat::fragment { 'dhcp.conf+10_failover.dhcp':
target => "${::dhcp::dhcp_dir}/dhcpd.conf",
target => "${dhcp::dhcp_dir}/dhcpd.conf",
content => template('dhcp/dhcpd.conf.failover.erb'),
order => '10',
}
Expand Down
12 changes: 11 additions & 1 deletion manifests/host.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Define a DHCP host reservation
#
# @param ip
# The IP address in the reservation
#
# @param mac
# The host's MAC address
#
# @param comment
# An optional comment for the host
define dhcp::host (
String $ip,
Dhcp::Macaddress $mac,
Expand All @@ -7,7 +17,7 @@
$host = $name

concat::fragment { "dhcp.hosts+10_${name}.hosts":
target => "${::dhcp::dhcp_dir}/dhcpd.hosts",
target => "${dhcp::dhcp_dir}/dhcpd.hosts",
content => template('dhcp/dhcpd.host.erb'),
order => "10-${name}",
}
Expand Down
7 changes: 4 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Manage an ISC DHCP server
class dhcp (
Array[String] $dnsdomain = $dhcp::params::dnsdomain,
Array[String] $nameservers = ['8.8.8.8', '8.8.4.4'],
Expand Down Expand Up @@ -69,7 +70,7 @@
}

# Only debian and ubuntu have this style of defaults for startup.
case $::osfamily {
case $facts['osfamily'] {
'Debian': {
file{ '/etc/default/isc-dhcp-server':
ensure => file,
Expand All @@ -82,8 +83,8 @@
}
}
'RedHat': {
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
include ::systemd
if versioncmp($facts['operatingsystemmajrelease'], '7') >= 0 {
include systemd
systemd::dropin_file { 'interfaces.conf':
unit => 'dhcpd.service',
content => template('dhcp/redhat/systemd-dropin.conf.erb'),
Expand Down
12 changes: 7 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Default parameters
# @api private
class dhcp::params {

$dnsdomain = [$::domain]
$dnsdomain = [$facts['domain']]
$pxefilename = 'pxelinux.0'

case $::osfamily {
case $facts['osfamily'] {
'Debian': {
$dhcp_dir = '/etc/dhcp'
$packagename = 'isc-dhcp-server'
Expand All @@ -18,7 +20,7 @@

/^(FreeBSD|DragonFly)$/: {
$dhcp_dir = '/usr/local/etc'
$packagename = 'isc-dhcp43-server'
$packagename = 'isc-dhcp44-server'
$servicename = 'isc-dhcpd'
$root_group = 'wheel'
$bootfiles = {}
Expand All @@ -37,7 +39,7 @@
$packagename = 'dhcp'
$servicename = 'dhcpd'
$root_group = 'root'
if $::operatingsystemrelease =~ /^[0-6]\./ {
if $facts['operatingsystemrelease'] =~ /^[0-6]\./ {
$bootfiles = {
'00:07' => 'grub/grubx64.efi',
'00:09' => 'grub/grubx64.efi',
Expand All @@ -52,7 +54,7 @@
}

default: {
fail("${::hostname}: This module does not support osfamily ${::osfamily}")
fail("${facts['hostname']}: This module does not support osfamily ${facts['osfamily']}")
}
}
}
3 changes: 2 additions & 1 deletion manifests/pool.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Define a DHCP pool
define dhcp::pool (
String $network,
String $mask,
Expand All @@ -19,7 +20,7 @@
) {

concat::fragment { "dhcp.conf+70_${name}.dhcp":
target => "${::dhcp::dhcp_dir}/dhcpd.conf",
target => "${dhcp::dhcp_dir}/dhcpd.conf",
content => template('dhcp/dhcpd.pool.erb'),
order => "70-${name}",
}
Expand Down
7 changes: 4 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-dhcp",
"version": "4.2.0",
"version": "4.3.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 < 6.0.0"
"version_requirement": ">= 4.6.1 < 7.0.0"
}
],
"operatingsystem_support": [
Expand Down Expand Up @@ -84,7 +84,8 @@
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"10",
"11"
"11",
"12"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

let(:pp) do
<<-EOS
$interface = $::facts['networking']['interfaces'][#{interface}]
$interface = $facts['networking']['interfaces'][#{interface}]
class { '::dhcp':
class { 'dhcp':
interfaces => ['#{interface}'],
}
::dhcp::pool { "default subnet":
dhcp::pool { "default subnet":
network => $interface['network'],
mask => $interface['netmask'],
}
::dhcp::host { $::fqdn:
dhcp::host { $facts['fqdn']:
ip => $interface['ip'],
mac => $interface['mac'],
}
Expand Down
Loading