File tree Expand file tree Collapse file tree 3 files changed +39
-10
lines changed Expand file tree Collapse file tree 3 files changed +39
-10
lines changed Original file line number Diff line number Diff line change 161161 }
162162 }
163163
164- if ($manage_recovery_conf == true ) {
165- concat { $recovery_conf_path:
166- owner => $user ,
167- group => $group ,
168- mode => ' 0640' ,
169- warn => true ,
170- notify => Class[' postgresql::server::reload' ],
171- }
172- }
173-
174164 if $::osfamily == ' RedHat' {
175165 if $::operatingsystemrelease =~ /^7/ or $::operatingsystem == ' Fedora' {
176166 # Template uses:
Original file line number Diff line number Diff line change 2929 fail(' postgresql::server::recovery use this resource but do not pass a parameter will avoid creating the recovery.conf, because it makes no sense.' )
3030 }
3131
32+ concat { $target:
33+ owner => $::postgresql::server::config::user ,
34+ group => $::postgresql::server::config::group ,
35+ force => true , # do not crash if there is no recovery conf file
36+ mode => ' 0640' ,
37+ warn => true ,
38+ notify => Class[' postgresql::server::reload' ],
39+ }
40+
3241 # Create the recovery.conf content
3342 concat::fragment { 'recovery.conf' :
3443 target => $target ,
Original file line number Diff line number Diff line change @@ -38,6 +38,36 @@ class { 'postgresql::server': }
3838 end
3939 end
4040
41+ describe 'should not create recovery if recovery config not specified' do
42+ after ( :all ) do
43+ pp = <<-EOS . unindent
44+ file { '/tmp/recovery.conf':
45+ ensure => absent,
46+ }
47+ EOS
48+
49+ apply_manifest ( pp , :catch_failures => true )
50+ end
51+
52+ it 'does not add conf file' do
53+ pp = <<-EOS . unindent
54+ class { 'postgresql::globals':
55+ recovery_conf_path => '/tmp/recovery.conf',
56+ manage_recovery_conf => true,
57+ }
58+
59+ class { 'postgresql::server': }
60+ EOS
61+
62+ apply_manifest ( pp , :catch_failures => true )
63+ apply_manifest ( pp , :catch_changes => true )
64+ end
65+
66+ describe file ( '/tmp/recovery.conf' ) do
67+ it { is_expected . not_to be_file }
68+ end
69+ end
70+
4171 describe 'should not manage recovery' do
4272 pp = <<-MANIFEST . unindent
4373 class { 'postgresql::globals':
You can’t perform that action at this time.
0 commit comments