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
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--fail-on-warnings
--no-140chars-check
--no-class_inherits_from_params_class-check
--no-parameter_documentation-check
8 changes: 5 additions & 3 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
.puppet-lint.rc:
extra_disabled_lint_checks:
- parameter_documentation
.travis.yml:
beaker_sets:
- centos6-64
- debian8-64
- debian9-64
- debian10-64
Rakefile:
param_docs_pattern:
- manifests/init.pp
- ubuntu1604-64
- ubuntu1804-64
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [8.0.0](https://github.com/theforeman/puppet-dns/tree/8.0.0) (2020-05-13)

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

**Breaking changes:**

- Use modern facts [\#169](https://github.com/theforeman/puppet-dns/issues/169)
- Make bind view clauses optional [\#163](https://github.com/theforeman/puppet-dns/pull/163) ([dlucredativ](https://github.com/dlucredativ))
- Make zone update\_policy\_rules more generic [\#157](https://github.com/theforeman/puppet-dns/pull/157) ([damluk](https://github.com/damluk))

**Implemented enhancements:**

- Fixes [\#29210](https://projects.theforeman.org/issues/29210) - support el8 [\#160](https://github.com/theforeman/puppet-dns/pull/160) ([wbclark](https://github.com/wbclark))
- Introduce several dnssec related zone options [\#158](https://github.com/theforeman/puppet-dns/pull/158) ([damluk](https://github.com/damluk))

## [7.0.0](https://github.com/theforeman/puppet-dns/tree/7.0.0) (2020-02-11)

[Full Changelog](https://github.com/theforeman/puppet-dns/compare/6.2.0...7.0.0)
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 = ["manifests/init.pp"]
end

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

task :default => [:release_checks]
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# such settings must be set in the global, common /etc/rc.conf file and under
# ArchLinux we must use systemd override files to change the startup
# commandline. These cases are outside of this module's scope.
if $facts['osfamily'] in ['Debian', 'RedHat'] {
if $facts['os']['family'] in ['Debian', 'RedHat'] {
file { $dns::sysconfig_file:
owner => 'root',
group => 'root',
Expand Down
10 changes: 5 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Default parameters
# @api private
class dns::params {
case $facts['osfamily'] {
case $facts['os']['family'] {
'Debian': {
$dnsdir = '/etc/bind'
$vardir = '/var/cache/bind'
Expand All @@ -18,7 +18,7 @@
$rndcconfgen = '/usr/sbin/rndc-confgen'
$named_checkconf = '/usr/sbin/named-checkconf'
$sysconfig_file = '/etc/default/bind9'
$sysconfig_template = "dns/sysconfig.${facts['osfamily']}.erb"
$sysconfig_template = "dns/sysconfig.${facts['os']['family']}.erb"
$sysconfig_startup_options = '-u bind'
$sysconfig_resolvconf_integration = false

Expand All @@ -41,7 +41,7 @@
$rndcconfgen = '/usr/sbin/rndc-confgen'
$named_checkconf = '/usr/sbin/named-checkconf'
$sysconfig_file = '/etc/sysconfig/named'
$sysconfig_template = "dns/sysconfig.${facts['osfamily']}.erb"
$sysconfig_template = "dns/sysconfig.${facts['os']['family']}.erb"
$sysconfig_startup_options = undef
$sysconfig_disable_zone_checking = undef

Expand Down Expand Up @@ -73,7 +73,7 @@
'Archlinux': {
$dnsdir = '/etc'
$vardir = '/var/named'
$optionspath = '/etc/named.options.conf'
$optionspath = "${dnsdir}/named.options.conf"
$zonefilepath = "${vardir}/dynamic"
$localzonepath = 'unmanaged' # "${dnsdir}/named.local.conf"
$defaultzonepath = 'unmanaged'
Expand All @@ -93,7 +93,7 @@
$sysconfig_resolvconf_integration = undef
}
default: {
fail ("Unsupported operating system family ${facts['osfamily']}")
fail ("Unsupported operating system family ${facts['os']['family']}")
}
}

Expand Down
34 changes: 17 additions & 17 deletions manifests/view.pp
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Define new view for the dns
define dns::view (
Array[String] $match_clients = [],
Array[String] $match_destinations = [],
Enum['yes','no'] $match_recursive_only = 'no',
Array[String] $allow_transfer = [],
Array[String] $allow_recursion = [],
Array[String] $allow_query = [],
Array[String] $allow_query_cache = [],
Array[String] $also_notify = [],
Array[String] $forwarders = [],
Enum['only','first'] $forward = 'first',
Enum['yes','no'] $recursion = 'yes',
Enum['yes','no'] $dnssec_enable = 'yes',
Enum['yes','no'] $dnssec_validation = 'yes',
Enum['yes','no'] $dns_notify = 'yes',
Boolean $include_localzones = true,
Boolean $include_defaultzones = true,
String $order = '-',
Array[String] $match_clients = [],
Array[String] $match_destinations = [],
Optional[Enum['yes','no']] $match_recursive_only = undef,
Array[String] $allow_transfer = [],
Array[String] $allow_recursion = [],
Array[String] $allow_query = [],
Array[String] $allow_query_cache = [],
Array[String] $also_notify = [],
Array[String] $forwarders = [],
Optional[Enum['only','first']] $forward = undef,
Optional[Enum['yes','no']] $recursion = undef,
Optional[Enum['yes','no']] $dnssec_enable = undef,
Optional[Enum['yes','no']] $dnssec_validation = undef,
Optional[Enum['yes','no','explicit']] $dns_notify = undef,
Boolean $include_localzones = true,
Boolean $include_defaultzones = true,
String $order = '-',
) {

unless $dns::enable_views {
Expand Down
Loading