21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Changelog

## [8.2.0](https://github.com/theforeman/puppet-dns/tree/8.2.0) (2021-04-26)
## [9.0.0](https://github.com/theforeman/puppet-dns/tree/9.0.0) (2021-07-22)

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

**Breaking changes:**

- Drop EL6 and Debian 8 and Ubuntu 16.04 support [\#193](https://github.com/theforeman/puppet-dns/pull/193) ([ehelms](https://github.com/ehelms))
- Drop Puppet 5 support [\#191](https://github.com/theforeman/puppet-dns/pull/191) ([ehelms](https://github.com/ehelms))

**Implemented enhancements:**

- Drop usage of -r from rndc-confgen [\#190](https://github.com/theforeman/puppet-dns/pull/190) ([karelyatin](https://github.com/karelyatin))
- Allow Puppet 7 compatible versions of mods [\#186](https://github.com/theforeman/puppet-dns/pull/186) ([ekohl](https://github.com/ekohl))
- Replace get\_in\_addr\_arpa with reverse\_dns function [\#175](https://github.com/theforeman/puppet-dns/pull/175) ([ekohl](https://github.com/ekohl))

**Closed issues:**

- create-rndc.key fails with bind9 9.13.0+ [\#189](https://github.com/theforeman/puppet-dns/issues/189)

## [8.2.0](https://github.com/theforeman/puppet-dns/tree/8.2.0) (2021-04-27)

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

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ gem 'voxpupuli-test', '~> 1.4'
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet_metadata', '~> 0.3'
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
gem 'voxpupuli-acceptance', '~> 0.3', {"groups"=>["system_tests"]}
gem 'voxpupuli-acceptance', '~> 1.0', {"groups"=>["system_tests"]}

# vim:ft=ruby
15 changes: 15 additions & 0 deletions lib/puppet/functions/dns/reverse_dns.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'ipaddr'

# @summary Get the reverse DNS for an IP address
Puppet::Functions.create_function(:'dns::reverse_dns') do
# @param ip
# The IP address to get the reverse for
dispatch :reverse do
param 'Stdlib::IP::Address::Nosubnet', :ip
return_type 'Stdlib::Fqdn'
end

def reverse(ip)
IPAddr.new(ip).reverse
end
end
10 changes: 10 additions & 0 deletions lib/puppet/functions/get_in_addr_arpa.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @summary DEPRECATED. Use the [`dns::reverse_dns`](#dnsreverse_dns) function instead.
Puppet::Functions.create_function(:get_in_addr_arpa) do
dispatch :deprecation_gen do
repeated_param 'Any', :args
end
def deprecation_gen(*args)
call_function('deprecation', 'get_in_addr_arpa', 'This method is deprecated, please use dns::reverse_dns instead.')
call_function('dns::reverse_dns', *args)
end
end
5 changes: 0 additions & 5 deletions lib/puppet/parser/functions/get_in_addr_arpa.rb

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
}

exec { 'create-rndc.key':
command => "${dns::rndcconfgen} -r /dev/urandom -a -c ${dns::rndckeypath}",
command => "${dns::rndcconfgen} -a -c ${dns::rndckeypath}",
creates => $dns::rndckeypath,
}
-> file { $dns::rndckeypath:
Expand Down
2 changes: 1 addition & 1 deletion manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}
} else {
exec { "create-${filename}":
command => "${dns::rndcconfgen} -r /dev/urandom -a -c ${keyfilename} -b ${keysize} -k ${name}",
command => "${dns::rndcconfgen} -a -c ${keyfilename} -b ${keysize} -k ${name}",
creates => $keyfilename,
before => Class['dns::config'],
notify => Class['dns::service'],
Expand Down
13 changes: 4 additions & 9 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-dns",
"version": "8.2.0",
"version": "9.0.0",
"author": "theforeman",
"summary": "Manage the ISC BIND daemon",
"license": "Apache-2.0",
Expand All @@ -18,40 +18,37 @@
"dependencies": [
{
"name": "puppetlabs/concat",
"version_requirement": ">= 4.1.0 < 7.0.0"
"version_requirement": ">= 4.1.0 < 8.0.0"
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.13.1 < 7.0.0"
"version_requirement": ">= 4.13.1 < 8.0.0"
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 5.5.8 < 8.0.0"
"version_requirement": ">= 6.15.0 < 8.0.0"
}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6",
"7",
"8"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"6",
"7",
"8"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"6",
"7"
]
},
Expand All @@ -64,15 +61,13 @@
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9",
"10"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"16.04",
"18.04"
]
},
Expand Down
22 changes: 11 additions & 11 deletions spec/acceptance/dns_spec.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
require 'spec_helper_acceptance'

describe 'Scenario: install bind' do
let(:pp) do
<<-EOS
include dns
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-EOS
include dns
dns::zone { 'example.com':
soa => 'ns1.example.com',
soaip => '192.0.2.1',
soaipv6 => '2001:db8::1',
}
EOS
dns::zone { 'example.com':
soa => 'ns1.example.com',
soaip => '192.0.2.1',
soaipv6 => '2001:db8::1',
}
EOS
end
end

it_behaves_like 'a idempotent resource'

service_name = fact('osfamily') == 'Debian' ? 'bind9' : 'named'

describe service(service_name) do
Expand Down
52 changes: 26 additions & 26 deletions spec/acceptance/logging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@

describe 'Scenario: install bind with logging enabled' do
context 'with logging enabled' do
let(:pp) do
<<-EOS
class { 'dns':
logging_categories => {
queries => {
channels => ['queries_file'],
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'dns':
logging_categories => {
queries => {
channels => ['queries_file'],
},
},
},
logging_channels => {
queries_file => {
file_path => '/var/log/named/queries.log',
file_versions => 6,
file_size => '50m',
log_type => 'file',
severity => 'dynamic',
print_time => 'yes',
logging_channels => {
queries_file => {
file_path => '/var/log/named/queries.log',
file_versions => 6,
file_size => '50m',
log_type => 'file',
severity => 'dynamic',
print_time => 'yes',
},
},
},
}
dns::zone { 'example.com':
soa => 'ns1.example.com',
soaip => '192.0.2.1',
soaipv6 => '2001:db8::1',
}
EOS
}
dns::zone { 'example.com':
soa => 'ns1.example.com',
soaip => '192.0.2.1',
soaipv6 => '2001:db8::1',
}
PUPPET
end
end

it_behaves_like 'a idempotent resource'

service_name = fact('osfamily') == 'Debian' ? 'bind9' : 'named'

describe service(service_name) do
Expand Down
64 changes: 32 additions & 32 deletions spec/acceptance/views_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@

describe 'Scenario: install bind with views enabled' do
context 'with views enabled' do
let(:pp) do
<<-EOS
class {'::dns':
enable_views => true,
}
dns::view { 'v4':
match_clients => ['0.0.0.0/0'],
}
dns::view { 'v6':
match_clients => ['::/0'],
}
dns::zone { 'example.com-v4':
zone => 'example.com',
soa => 'ns1-v4.example.com',
soaip => '192.0.2.1',
filename => 'db.example.com-v4',
target_views => ['v4'],
}
dns::zone { 'example.com-v6':
zone => 'example.com',
soa => 'ns1-v6.example.com',
soaipv6 => '2001:db8::1',
filename => 'db.example.com-v6',
target_views => ['v6'],
}
EOS
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class {'::dns':
enable_views => true,
}
dns::view { 'v4':
match_clients => ['0.0.0.0/0'],
}
dns::view { 'v6':
match_clients => ['::/0'],
}
dns::zone { 'example.com-v4':
zone => 'example.com',
soa => 'ns1-v4.example.com',
soaip => '192.0.2.1',
filename => 'db.example.com-v4',
target_views => ['v4'],
}
dns::zone { 'example.com-v6':
zone => 'example.com',
soa => 'ns1-v6.example.com',
soaipv6 => '2001:db8::1',
filename => 'db.example.com-v6',
target_views => ['v6'],
}
PUPPET
end
end

it_behaves_like 'a idempotent resource'

service_name = fact('osfamily') == 'Debian' ? 'bind9' : 'named'

describe service(service_name) do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/dns_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
it { should contain_file(zonefilepath).with_ensure('directory') }
it do
should contain_exec('create-rndc.key')
.with_command("#{sbin}/rndc-confgen -r /dev/urandom -a -c #{rndc_key}")
.with_command("#{sbin}/rndc-confgen -a -c #{rndc_key}")
.with_creates(rndc_key)
end
it { should contain_file(rndc_key) }
Expand Down
7 changes: 7 additions & 0 deletions spec/functions/reverse_dns_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe 'dns::reverse_dns' do
it { is_expected.to run.with_params('192.0.2.100').and_return('100.2.0.192.in-addr.arpa') }
it { is_expected.to run.with_params('2001:db8::').and_return('0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa') }
it { is_expected.to run.with_params('2001:db8').and_raise_error(ArgumentError, /parameter 'ip' expects a Stdlib::IP::Address::Nosubnet/) }
end
25 changes: 0 additions & 25 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,6 @@
# refresh check if cache needs refresh on next yum command
on host, 'yum clean expire-cache'
end

local_setup = File.join(__dir__, 'setup_acceptance_node.pp')
if File.exist?(local_setup)
puts "Configuring #{host} by applying #{local_setup}"
apply_manifest_on(host, File.read(local_setup), catch_failures: true)
end
end

shared_examples 'a idempotent resource' do
it 'applies with no errors' do
apply_manifest(pp, catch_failures: true)
end

it 'applies a second time without changes' do
apply_manifest(pp, catch_changes: true)
end
end

shared_examples 'the example' do |name|
let(:pp) do
path = File.join(File.dirname(__dir__), 'examples', name)
File.read(path)
end

include_examples 'a idempotent resource'
end

Dir["./spec/support/acceptance/**/*.rb"].sort.each { |f| require f }