Skip to content

Commit 2d44d30

Browse files
committed
Merge branch 'release/0.0.12'
2 parents d72125f + df08a34 commit 2d44d30

File tree

10 files changed

+128
-116
lines changed

10 files changed

+128
-116
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 0.0.12
2+
3+
### Summary
4+
5+
We have dropped Ruby 1.9.3 from our tests and added Rubocop coverage to
6+
ensure we write decent code where possible.
7+
8+
### Features
9+
- Rubocop coverage for all Ruby code in this module.
10+
11+
### Bugfixes
12+
- The README wrongly mentioned listen-address instead of local-address
13+
114
## 0.0.11
215

316
### Summary

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ example below needs to be adjusted to use the ip addresses of your server.
2828
This may fail the first time on Debian-based distro's.
2929

3030
```
31-
powerdns::config { 'authoritative-listen-address':
31+
powerdns::config { 'authoritative-local-address':
3232
type => 'authoritative',
33-
setting => 'listen-address',
33+
setting => 'local-address',
3434
value => '127.0.0.1',
3535
}
36-
powerdns::config { 'recursor-listen-address':
36+
powerdns::config { 'recursor-local-address':
3737
type => 'recursor',
38-
setting => 'listen-address',
38+
setting => 'local-address',
3939
value => '127.0.0.2',
4040
}
4141
class { 'powerdns':

Rakefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ end
3535

3636
desc 'Run metadata_lint, lint, validate, and spec tests.'
3737
task :test do
38-
# This should be changed once we drop support for 1.9.3 to
39-
# %i[metadata_lint lint validate rubocop spec].each
40-
[:metadata_lint, :lint, :validate, :spec].each do |test|
38+
%i[metadata_lint lint validate rubocop spec].each do |test|
4139
Rake::Task[test].invoke
4240
end
4341
end

Vagrantfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Vagrant.configure(2) do |config|
1212

1313
# Every Vagrant development environment requires a box. You can search for
1414
# boxes at https://atlas.hashicorp.com/search.
15-
config.vm.box = "ubuntu/trusty64"
15+
config.vm.box = 'ubuntu/trusty64'
1616

1717
# Disable automatic box update checking. If you disable this, then
1818
# boxes will only be checked for updates when the user runs
@@ -26,32 +26,32 @@ Vagrant.configure(2) do |config|
2626

2727
# Create a private network, which allows host-only access to the machine
2828
# using a specific IP.
29-
config.vm.network "private_network", ip: "192.168.33.10"
29+
config.vm.network 'private_network', ip: '192.168.33.10'
3030

3131
# Create a public network, which generally matched to bridged network.
3232
# Bridged networks make the machine appear as another physical device on
3333
# your network.
3434
# config.vm.network "public_network"
3535

3636
# Set up the hostname
37-
config.vm.hostname = "powerdns"
37+
config.vm.hostname = 'powerdns'
3838

3939
# Share an additional folder to the guest VM. The first argument is
4040
# the path on the host to the actual folder. The second argument is
4141
# the path on the guest to mount the folder. And the optional third
4242
# argument is a set of non-required options.
43-
config.vm.synced_folder ".", "/vagrant", nfs: true
43+
config.vm.synced_folder '.', '/vagrant', nfs: true
4444

4545
# Provider-specific configuration so you can fine-tune various
4646
# backing providers for Vagrant. These expose provider-specific options.
4747
# Example for VirtualBox:
4848
#
49-
config.vm.provider "virtualbox" do |vb|
49+
config.vm.provider 'virtualbox' do |vb|
5050
# Display the VirtualBox GUI when booting the machine
5151
vb.gui = false
52-
52+
5353
# Customize the amount of memory on the VM:
54-
vb.memory = "2048"
54+
vb.memory = '2048'
5555
end
5656
#
5757
# View the documentation for the provider you are using for more
@@ -67,7 +67,7 @@ Vagrant.configure(2) do |config|
6767
# Enable provisioning with a shell script. Additional provisioners such as
6868
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
6969
# documentation for more information about their specific syntax and use.
70-
config.vm.provision "shell", inline: <<-SHELL
70+
config.vm.provision 'shell', inline: <<-SHELL
7171
sudo apt-get update
7272
sudo apt-get install -y bundler git zlib1g-dev
7373
cd /vagrant

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sensson-powerdns",
3-
"version": "0.0.11",
3+
"version": "0.0.12",
44
"author": "sensson",
55
"license": "Apache-2.0",
66
"summary": "A module to install and configure PowerDNS 4.x authoritative server and recursor",

spec/acceptance/class_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
context 'authoritative server' do
55
# Using puppet_apply as a helper
66
it 'should work idempotently with no errors' do
7-
pp = <<-EOS
7+
pp = <<-PUPPET
88
class { 'powerdns':
99
db_password => 's0m4r4nd0mp4ssw0rd',
1010
db_root_password => 'v3rys3c4r3',
@@ -18,26 +18,26 @@ class { 'powerdns':
1818
setting => 'local-port',
1919
value => 54,
2020
}
21-
EOS
21+
PUPPET
2222

2323
# Run it twice and test for idempotency
24-
apply_manifest(pp, :catch_failures => true)
25-
apply_manifest(pp, :catch_changes => true)
24+
apply_manifest(pp, catch_failures: true)
25+
apply_manifest(pp, catch_changes: true)
2626
end
2727
end
2828

2929
context 'recursor server' do
3030
it 'should work idempotently with no errors' do
31-
pp = <<-EOS
31+
pp = <<-PUPPET
3232
class { 'powerdns':
3333
authoritative => false,
3434
recursor => true,
3535
}
36-
EOS
36+
PUPPET
3737

3838
# Run it twice and test for idempotency
39-
apply_manifest(pp, :catch_failures => true)
40-
apply_manifest(pp, :catch_changes => true)
39+
apply_manifest(pp, catch_failures: true)
40+
apply_manifest(pp, catch_changes: true)
4141
end
4242
end
4343
end

spec/classes/coverage_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
at_exit { RSpec::Puppet::Coverage.report! }
1+
at_exit { RSpec::Puppet::Coverage.report! }

spec/classes/powerdns_init_spec.rb

Lines changed: 65 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
override_facts = {
2+
root_home: '/root'
3+
}
4+
15
require 'spec_helper'
2-
describe 'powerdns', :type => :class do
6+
describe 'powerdns', type: :class do
37
context 'supported operating systems' do
48
on_supported_os.each do |os, facts|
59
context "on #{os}" do
610
let(:facts) do
7-
facts
8-
9-
facts.merge({
10-
:root_home => '/root',
11-
})
11+
facts.merge(override_facts)
1212
end
1313

1414
case facts[:osfamily]
@@ -18,28 +18,28 @@
1818
authoritative_config = '/etc/pdns/pdns.conf'
1919
recursor_package_name = 'pdns-recursor'
2020
recursor_service_name = 'pdns-recursor'
21-
recursor_config = '/etc/pdns-recursor/recursor.conf'
2221
when 'Debian'
2322
authoritative_package_name = 'pdns-server'
2423
authoritative_service_name = 'pdns'
2524
authoritative_config = '/etc/powerdns/pdns.conf'
2625
recursor_package_name = 'pdns-recursor'
2726
recursor_service_name = 'pdns-recursor'
28-
recursor_config = '/etc/powerdns/recursor.conf'
2927
end
3028

31-
context "powerdns class without parameters" do
29+
context 'powerdns class without parameters' do
3230
it 'fails' do
3331
expect { subject.call } .to raise_error(/Database root password can't be empty/)
3432
end
3533
end
3634

37-
context "powerdns class with parameters" do
38-
let(:params) {{
39-
:db_root_password => 'foobar',
40-
:db_username => 'foo',
41-
:db_password => 'bar'
42-
}}
35+
context 'powerdns class with parameters' do
36+
let(:params) do
37+
{
38+
db_root_password: 'foobar',
39+
db_username: 'foo',
40+
db_password: 'bar'
41+
}
42+
end
4343

4444
it { is_expected.to compile.with_all_deps }
4545
it { is_expected.to contain_class('powerdns::params') }
@@ -65,24 +65,22 @@
6565
it { is_expected.to contain_package(authoritative_package_name).with('ensure' => 'installed') }
6666
it { is_expected.to contain_service(authoritative_service_name).with('ensure' => 'running') }
6767
it { is_expected.to contain_service(authoritative_service_name).with('enable' => 'true') }
68-
it { is_expected.to contain_service(authoritative_service_name).that_requires('Package[%s]' % [authoritative_package_name]) }
68+
it { is_expected.to contain_service(authoritative_service_name).that_requires(format('Package[%s]', authoritative_package_name)) }
6969
end
7070

71-
context "powerdns class with mysql backend" do
72-
let(:params) {{
73-
:db_root_password => 'foobar',
74-
:db_username => 'foo',
75-
:db_password => 'bar',
76-
:backend => 'mysql'
77-
}}
71+
context 'powerdns class with mysql backend' do
72+
let(:params) do
73+
{
74+
db_root_password: 'foobar',
75+
db_username: 'foo',
76+
db_password: 'bar',
77+
backend: 'mysql'
78+
}
79+
end
7880

7981
it { is_expected.to contain_class('powerdns::backends::mysql') }
8082
it { is_expected.to contain_package('pdns-backend-mysql').with('ensure' => 'installed') }
81-
it { is_expected.to contain_mysql__db('powerdns').with(
82-
'user' => 'foo',
83-
'password' => 'bar',
84-
'host' => 'localhost'
85-
) }
83+
it { is_expected.to contain_mysql__db('powerdns').with('user' => 'foo', 'password' => 'bar', 'host' => 'localhost') }
8684

8785
# We expect the following tables to be created
8886
it { is_expected.to contain_powerdns__backends__mysql__create_table('comments') }
@@ -116,22 +114,23 @@
116114
it { is_expected.to contain_powerdns__config('gmysql-user').with('value' => 'foo') }
117115
it { is_expected.to contain_powerdns__config('launch').with('value' => 'gmysql') }
118116

119-
it { is_expected.to contain_file_line('powerdns-config-gmysql-dbname-%s' % [ authoritative_config ]) }
120-
it { is_expected.to contain_file_line('powerdns-config-gmysql-password-%s' % [ authoritative_config ]) }
121-
it { is_expected.to contain_file_line('powerdns-config-gmysql-user-%s' % [ authoritative_config ]) }
122-
it { is_expected.to contain_file_line('powerdns-config-launch-%s' % [ authoritative_config ]) }
123-
117+
it { is_expected.to contain_file_line(format('powerdns-config-gmysql-dbname-%s', authoritative_config)) }
118+
it { is_expected.to contain_file_line(format('powerdns-config-gmysql-password-%s', authoritative_config)) }
119+
it { is_expected.to contain_file_line(format('powerdns-config-gmysql-user-%s', authoritative_config)) }
120+
it { is_expected.to contain_file_line(format('powerdns-config-launch-%s', authoritative_config)) }
124121
end
125122

126123
# Test the recursor
127-
context "powerdns class with the recursor enabled and the authoritative server disabled" do
128-
let(:params) {{
129-
:db_root_password => 'foobar',
130-
:db_username => 'foo',
131-
:db_password => 'bar',
132-
:recursor => true,
133-
:authoritative => false,
134-
}}
124+
context 'powerdns class with the recursor enabled and the authoritative server disabled' do
125+
let(:params) do
126+
{
127+
db_root_password: 'foobar',
128+
db_username: 'foo',
129+
db_password: 'bar',
130+
recursor: true,
131+
authoritative: false
132+
}
133+
end
135134

136135
it { is_expected.to compile.with_all_deps }
137136
it { is_expected.to contain_class('powerdns::params') }
@@ -141,40 +140,46 @@
141140
it { is_expected.to contain_package(recursor_package_name).with('ensure' => 'installed') }
142141
it { is_expected.to contain_service(recursor_service_name).with('ensure' => 'running') }
143142
it { is_expected.to contain_service(recursor_service_name).with('enable' => 'true') }
144-
it { is_expected.to contain_service(recursor_service_name).that_requires('Package[%s]' % [recursor_package_name]) }
143+
it { is_expected.to contain_service(recursor_service_name).that_requires(format('Package[%s]', recursor_package_name)) }
145144
end
146145

147146
# Test errors
148-
context "powerdns class with an empty database username" do
149-
let(:params) {{
150-
:db_root_password => 'foobar',
151-
:db_username => '',
152-
:db_password => 'bar'
153-
}}
147+
context 'powerdns class with an empty database username' do
148+
let(:params) do
149+
{
150+
db_root_password: 'foobar',
151+
db_username: '',
152+
db_password: 'bar'
153+
}
154+
end
154155

155156
it 'fails' do
156157
expect { subject.call } .to raise_error(/Database username can't be empty/)
157158
end
158159
end
159160

160-
context "powerdns class without database password" do
161-
let(:params) {{
162-
:db_root_password => 'foobar',
163-
:db_username => 'foo'
164-
}}
161+
context 'powerdns class without database password' do
162+
let(:params) do
163+
{
164+
db_root_password: 'foobar',
165+
db_username: 'foo'
166+
}
167+
end
165168

166169
it 'fails' do
167170
expect { subject.call } .to raise_error(/Database password can't be empty/)
168171
end
169172
end
170173

171-
context "powerdns class with an unsupported backend" do
172-
let(:params) {{
173-
:db_root_password => 'foobar',
174-
:db_username => 'foo',
175-
:db_password => 'bar',
176-
:backend => 'awesomedb'
177-
}}
174+
context 'powerdns class with an unsupported backend' do
175+
let(:params) do
176+
{
177+
db_root_password: 'foobar',
178+
db_username: 'foo',
179+
db_password: 'bar',
180+
backend: 'awesomedb'
181+
}
182+
end
178183

179184
it 'fails' do
180185
expect { subject.call } .to raise_error(/is not supported/)

0 commit comments

Comments
 (0)