newer pg module
[mirror/dsa-puppet.git] / 3rdparty / modules / postgresql / manifests / server / recovery.pp
1 # This resource manages the parameters that applies to the recovery.conf template. See README.md for more details.
2 define postgresql::server::recovery(
3   $restore_command                = undef,
4   $archive_cleanup_command        = undef,
5   $recovery_end_command           = undef,
6   $recovery_target_name           = undef,
7   $recovery_target_time           = undef,
8   $recovery_target_xid            = undef,
9   $recovery_target_inclusive      = undef,
10   $recovery_target                = undef,
11   $recovery_target_timeline       = undef,
12   $pause_at_recovery_target       = undef,
13   $standby_mode                   = undef,
14   $primary_conninfo               = undef,
15   $primary_slot_name              = undef,
16   $trigger_file                   = undef,
17   $recovery_min_apply_delay       = undef,
18   $target                         = $postgresql::server::recovery_conf_path
19 ) {
20
21   if $postgresql::server::manage_recovery_conf == false {
22     fail('postgresql::server::manage_recovery_conf has been disabled, so this resource is now unused and redundant, either enable that option or remove this resource from your manifests')
23   } else {
24     if($restore_command == undef and $archive_cleanup_command == undef and $recovery_end_command == undef
25       and $recovery_target_name == undef and $recovery_target_time == undef and $recovery_target_xid == undef
26       and $recovery_target_inclusive == undef and $recovery_target == undef and $recovery_target_timeline == undef
27       and $pause_at_recovery_target == undef and $standby_mode == undef and $primary_conninfo == undef
28       and $primary_slot_name == undef and $trigger_file == undef and $recovery_min_apply_delay == undef) {
29       fail('postgresql::server::recovery use this resource but do not pass a parameter will avoid creating the recovery.conf, because it makes no sense.')
30     }
31
32     # Create the recovery.conf content
33     concat::fragment { 'recovery.conf':
34       target  => $target,
35       content => template('postgresql/recovery.conf.erb'),
36     }
37   }
38 }