Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zone files should only be created or modified for master zones #99

Merged
merged 3 commits into from Apr 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion manifests/zone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
file { $zone_file:
ensure => absent,
}
} else {
} elsif $zone_type == 'master' {
# Zone Database

# Create "fake" zone file without zone-serial
Expand Down Expand Up @@ -74,6 +74,12 @@
require => Class['dns::server::install'],
notify => Class['dns::server::service'],
}
} else {
# For any zone file that is not a master zone, we should make sure
# we don't have a staging file
concat { $zone_file_stage:
ensure => absent
}
}

# Include Zone in named.conf.local
Expand Down
82 changes: 81 additions & 1 deletion spec/defines/dns__zone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
with_content(/forward/)
end
end

context 'with a forward zone' do
let :params do
{ :allow_transfer => ['123.123.123.123'],
Expand All @@ -103,7 +104,7 @@
end
it 'should not have allow_tranfer entry' do
should_not contain_concat__fragment('named.conf.local.test.com.include').
with_content(/allow_transfer/)
with_content(/allow-transfer/)
end
it 'should not have file entry' do
should_not contain_concat__fragment('named.conf.local.test.com.include').
Expand All @@ -117,7 +118,86 @@
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/forwarders/)
end
it 'should have an "absent" zone file concat' do
should contain_concat('/etc/bind/zones/db.test.com.stage').with({
:ensure => "absent"
})
end
end

context 'with a slave zone' do
let :params do
{ :slave_masters => ['123.123.123.123'],
:zone_type => 'slave'
}
end
it 'should have a type slave entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/type slave/)
end
it 'should have file entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/file/)
end
it 'should have masters entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/masters/)
end
it 'should not have allow_tranfer entry' do
should_not contain_concat__fragment('named.conf.local.test.com.include').
with_content(/allow-transfer/)
end
it 'should not have any forward information' do
should_not contain_concat__fragment('named.conf.local.test.com.include').
with_content(/forward/)
end
it 'should have an "absent" zone file concat' do
should contain_concat('/etc/bind/zones/db.test.com.stage').with({
:ensure => "absent"
})
end
end

context 'with a master zone' do
let :params do
{ :allow_transfer => ['8.8.8.8','8.8.4.4'],
:allow_forwarder => ['8.8.8.8', '208.67.222.222'],
:forward_policy => 'only',
:zone_type => 'master'
}
end
it 'should have a type master entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/type master/)
end
it 'should have file entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/file/)
end
it 'should not have masters entry' do
should_not contain_concat__fragment('named.conf.local.test.com.include').
with_content(/masters/)
end
it 'should have allow_tranfer entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/allow-transfer/)
end
it 'should have a forward-policy entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/forward /)
end
it 'should have a forwarders entry' do
should contain_concat__fragment('named.conf.local.test.com.include').
with_content(/forwarders/)
end
it 'should have a zone file concat' do
should contain_concat('/etc/bind/zones/db.test.com.stage').with({
:ensure => "present"
})
end
end


end
end