1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ junit/
pkg/
coverage/
.yardoc/
REFERENCE.md

## InteliJ / RubyMine
.idea
Expand Down
2 changes: 1 addition & 1 deletion .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--fail-on-warnings
--no-140chars-check
--no-class_inherits_from_params_class-check
--no-documentation-check
--no-parameter_documentation-check
9 changes: 6 additions & 3 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
.puppet-lint.rc:
extra_disabled_lint_checks:
- parameter_documentation
.travis.yml:
beaker_sets:
- centos7-64
- centos8-64
- debian8-64
- debian9-64
- debian10-64
.puppet-lint.rc:
extra_disabled_lint_checks:
- 'documentation'
- ubuntu1604-64
- ubuntu1804-64
66 changes: 66 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ matrix:
- 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=centos8-64{hostname=centos8-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=centos8-64{hostname=centos8-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
Expand Down Expand Up @@ -97,5 +119,49 @@ matrix:
- 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=ubuntu1604-64{hostname=ubuntu1604-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=ubuntu1604-64{hostname=ubuntu1604-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=ubuntu1804-64{hostname=ubuntu1804-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=ubuntu1804-64{hostname=ubuntu1804-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
dist: xenial
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## [6.0.0](https://github.com/theforeman/puppet-dhcp/tree/6.0.0) (2020-05-12)

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

**Breaking changes:**

- Use modern facts [\#175](https://github.com/theforeman/puppet-dhcp/issues/175)

**Implemented enhancements:**

- Fixes [\#29189](https://projects.theforeman.org/issues/29189) - Support el8 [\#167](https://github.com/theforeman/puppet-dhcp/pull/167) ([wbclark](https://github.com/wbclark))
- Support iPXE without chain-loading [\#150](https://github.com/theforeman/puppet-dhcp/pull/150) ([neomilium](https://github.com/neomilium))

**Merged pull requests:**

- document failover parameters [\#170](https://github.com/theforeman/puppet-dhcp/pull/170) ([wbclark](https://github.com/wbclark))

## [5.1.1](https://github.com/theforeman/puppet-dhcp/tree/5.1.1) (2020-02-12)

[Full Changelog](https://github.com/theforeman/puppet-dhcp/compare/5.1.0...5.1.1)
Expand All @@ -20,6 +37,10 @@

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

**Breaking changes:**

- Default nameservers to an empty array [\#171](https://github.com/theforeman/puppet-dhcp/pull/171) ([jhoblitt](https://github.com/jhoblitt))

**Merged pull requests:**

- allow newer puppetlabs-concat version [\#157](https://github.com/theforeman/puppet-dhcp/pull/157) ([mmoll](https://github.com/mmoll))
Expand All @@ -32,7 +53,6 @@
**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:**

Expand Down
66 changes: 54 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,22 @@ Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby
package manager such as [bundler](https://bundler.io/) what Ruby packages,
or Gems, are required to build, develop, and test this software.

Please make sure you have [bundler installed](https://bundler.io/#getting-started)
on your system, then use it to install all dependencies needed for this project,
by running

```shell
% bundle install
**Prerequisites**
1. Make sure you have [bundler installed](https://bundler.io/#getting-started)
on your system. If you are using Fedora, you can get `bundler` using
```shell
sudo dnf install rubygem-bundler
```
2. If you are using Fedora, you may need these additional packages
```shell
sudo dnf install -y ruby-devel redhat-rpm-config
```

Now, go to the root directory of this project and use `bundler` to install all
dependencies needed for this project by running

```console
$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Expand All @@ -159,21 +169,43 @@ NOTE some systems may require you to run this command with sudo.
If you already have those gems installed, make sure they are up-to-date:

```shell
% bundle update
bundle update
```

With all dependencies in place and up-to-date we can now run the tests:

```shell
% rake spec
rake spec
```

This will execute all the [rspec tests](http://rspec-puppet.com/) tests
under [spec/defines](./spec/defines), [spec/classes](./spec/classes),
and so on. rspec tests may have the same kind of dependencies as the
module they are testing. While the module defines in its [Modulefile](./Modulefile),
This will execute all the [rspec tests](http://rspec-puppet.com/) tests under
[spec/defines](./spec/defines), [spec/classes](./spec/classes), and so on.
rspec tests may have the same kind of dependencies as the module they are
testing. While the module defines in its [metadata.json](./metadata.json),
rspec tests define them in [.fixtures.yml](./fixtures.yml).

To run specific tests, use the spec test file name and a filter like:

```shell
bundle exec rspec spec/classes/foreman_spec.rb -e 'should restart passenger'
```
More filter info available [here](https://relishapp.com/rspec/rspec-core/v/3-9/docs/command-line/example-option)

To run OS specific tests:

```shell
SPEC_FACTS_OS=redhat-7-x86_64 bundle exec rspec spec/classes/foreman_spec.rb
```

If you have more than one version of `redhat` OS specified in metadata.json,
you can run them all like:

```shell
SPEC_FACTS_OS=redhat bundle exec rspec spec/classes/foreman_spec.rb
```
For more information on running the tests, see [rspec-puppet-facts](https://github.com/mcanevet/rspec-puppet-facts)
and specifically the [section for running tests](https://github.com/mcanevet/rspec-puppet-facts#running-your-tests).

Writing Tests
-------------

Expand Down Expand Up @@ -246,3 +278,13 @@ Additional Resources
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
Modulesync
==========
Various files, including this one, are
[modulesynced](https://github.com/voxpupuli/modulesync) using
[foreman-installer-modulesync](https://github.com/theforeman/foreman-installer-modulesync)
configuration. Changes should be made over there and then synced to
all [managed
modules](https://github.com/theforeman/foreman-installer-modulesync/blob/master/managed_modules.yml).
30 changes: 5 additions & 25 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,16 @@ source 'https://rubygems.org'

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

gem 'rake'
gem 'rspec', '~> 3.0'
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-classes_and_types_beginning_with_digits-check'
gem 'kafo_module_lint'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-param-docs', '>= 1.3.0'
gem 'puppet-lint-spaceship_operator_without_tag-check'
gem 'puppet-lint-strict_indent-check'
gem 'puppet-lint-trailing_comma-check'
gem 'puppet-lint-undef_in_function-check'
gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-version_comparison-check'
gem 'simplecov'
gem 'github_changelog_generator', '>= 1.15.0'
gem 'puppet-blacksmith', '>= 4.1.0', {"groups"=>["development"]}
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"]}
gem 'beaker-rspec', {"groups"=>["system_tests"]}
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 'parallel_tests'
gem 'voxpupuli-test', '~> 1.4'
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
gem 'voxpupuli-acceptance', '~> 0.2', {"groups"=>["system_tests"]}

# vim:ft=ruby
21 changes: 4 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# This file is managed centrally by modulesync
# https://github.com/theforeman/foreman-installer-modulesync

require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'voxpupuli/test/rake'

# We use fixtures in our modules, which is not the default
task :beaker => 'spec_prep'

# blacksmith isn't always present, e.g. on Travis with --without development
begin
Expand Down Expand Up @@ -39,18 +41,3 @@ begin
end
rescue LoadError
end

PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"]
PuppetLint.configuration.log_format = '%{path}:%{line}:%{KIND}: %{message}'

require 'puppet-lint-param-docs/tasks'
PuppetLintParamDocs.define_selective do |config|
config.pattern = []
end

require 'kafo_module_lint/tasks'
KafoModuleLint::RakeTask.new do |config|
config.pattern = []
end

task :default => [:release_checks]
29 changes: 28 additions & 1 deletion manifests/failover.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,37 @@
#
# @param peer_address
# The address of the failover peer.
#
# @param role
# Primary or Secondary role in DHCP failover relationship.
#
# @param address
# IP Address of the DHCP failover server.
#
# @param port
# Port to listen for failover messages.
#
# @param max_response_delay
# max-response-delay in seconds before failover peer is considered failed.
#
# @param max_unacked_updated
# max-unacked-updates before the server will wait to send additional packets to peer.
#
# @param mclt
# MCLT, the maximum time a lease may be extended beyond expiration set by DHCP peer.
#
# @param load_split
# Load split between the DHCP servers as fraction out of 256.
#
# @param load_balance
# Load balance max seconds, cutoff after which load balancing is disabled.
#
# @param omapi_key
# OMAPI key to cryptographically sign traffic if OMAPI protocol is enabled.
class dhcp::failover (
String $peer_address,
Enum['primary', 'secondary'] $role = 'primary',
String $address = $facts['ipaddress'],
String $address = $facts['networking']['ip'],
Variant[Integer[0, 65535], String] $port = 519,
Variant[Integer[0], String] $max_response_delay = 30,
Variant[Integer[0], String] $max_unacked_updates = 10,
Expand Down
Loading