Fix idempotency and re-enable idempotency check in beaker tests

- Change file_line resources to concat resources instead to
  concat a fragment within the puppet-dns concat templates
  resources.

This change depends on an upstream change to puppet-dns which
has not yet merged.
https://github.com/theforeman/puppet-dns/pull/64

Change-Id: I499f2c7bfe8330ddb3c3d91d5eadcdad9e64e614
Depends-On: I73145a8992292038ab22824d3a858dcc7193fd35
This commit is contained in:
David Moreau-Simard 2016-07-06 12:21:30 -04:00
parent 350b4938a3
commit 63cdcd713a
3 changed files with 10 additions and 11 deletions

View File

@ -25,7 +25,7 @@ class designate::backend::bind9 (
$rndc_port = '953',
$rndc_config_file = '/etc/rndc.conf',
$rndc_key_file = '/etc/rndc.key'
) inherits designate::params {
) {
include ::designate
include ::dns
@ -36,11 +36,9 @@ class designate::backend::bind9 (
'backend:bind9/rndc_key_file' : value => $rndc_key_file;
}
file_line { 'dns allow-new-zones':
ensure => present,
path => $::dns::optionspath,
line => 'allow-new-zones yes;',
require => Class['::designate'],
notify => Service[$::dns::namedservicename]
concat::fragment { 'dns allow-new-zones':
target => $::dns::optionspath,
content => 'allow-new-zones yes;',
order => '20',
}
}

View File

@ -59,10 +59,9 @@ describe 'basic designate' do
}
EOS
# Run it once, idempotency does not work
# this is what we have each time we run puppet after first time:
# http://paste.openstack.org/show/2ebHALkNguNsE0804Oev/
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe port(9001) do

View File

@ -12,7 +12,9 @@ describe 'designate::backend::bind9' do
is_expected.to contain_designate_config('backend:bind9/rndc_port').with_value('953')
is_expected.to contain_designate_config('backend:bind9/rndc_config_file').with_value('/etc/rndc.conf')
is_expected.to contain_designate_config('backend:bind9/rndc_key_file').with_value('/etc/rndc.key')
is_expected.to contain_file_line('dns allow-new-zones').with( :path => platform_params[:dns_optionspath], :line => 'allow-new-zones yes;')
is_expected.to contain_concat_fragment('dns allow-new-zones').with(
:target => platform_params[:dns_optionspath],
:content => 'allow-new-zones yes;')
end
end