|
2 | 2 | #
|
3 | 3 | # @param ensure Removes an entry if set to 'absent'.
|
4 | 4 | # @param value Defines the value for the setting.
|
5 |
| -# @param path Path for postgresql.conf |
| 5 | +# @param path Path for postgresql.conf |
6 | 6 | #
|
7 | 7 | define postgresql::server::config_entry (
|
8 | 8 | Enum['present', 'absent'] $ensure = 'present',
|
|
70 | 70 | 'max_pred_locks_per_transaction' => undef,
|
71 | 71 | }
|
72 | 72 |
|
73 |
| - Exec { |
74 |
| - logoutput => 'on_failure', |
75 |
| - } |
76 |
| - |
77 | 73 | if ! ($name in $requires_restart_until and (
|
78 | 74 | ! $requires_restart_until[$name] or
|
79 | 75 | versioncmp($postgresql::server::_version, $requires_restart_until[$name]) < 0
|
|
91 | 87 | }
|
92 | 88 | }
|
93 | 89 |
|
94 |
| - # We have to handle ports and the data directory in a weird and |
95 |
| - # special way. On early Debian and Ubuntu and RHEL we have to ensure |
96 |
| - # we stop the service completely. On RHEL 7 we either have to create |
97 |
| - # a systemd override for the port or update the sysconfig file, but this |
98 |
| - # is managed for us in postgresql::server::config. |
99 |
| - if $facts['os']['name'] == 'Debian' or $facts['os']['name'] == 'Ubuntu' { |
100 |
| - if $name == 'data_directory' { |
101 |
| - $stop_command = ['service', $postgresql::server::service_name, 'stop'] |
102 |
| - $stop_onlyif = ['service', $postgresql::server::service_name, 'status'] |
103 |
| - $stop_unless = [['grep', "data_directory = '${value}'", $postgresql::server::postgresql_conf_path]] |
104 |
| - exec { "postgresql_stop_${name}": |
105 |
| - command => $stop_command, |
106 |
| - onlyif => $stop_onlyif, |
107 |
| - unless => $stop_unless, |
108 |
| - path => '/usr/sbin:/sbin:/bin:/usr/bin:/usr/local/bin', |
109 |
| - before => Postgresql_conf[$name], |
110 |
| - } |
111 |
| - } |
112 |
| - } elsif $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '7') < 0 { |
113 |
| - if $name == 'port' { |
114 |
| - # We need to force postgresql to stop before updating the port |
115 |
| - # because puppet becomes confused and is unable to manage the |
116 |
| - # service appropriately. |
117 |
| - $stop_command = ['service', $postgresql::server::service_name, 'stop'] |
118 |
| - $stop_onlyif = ['service', $postgresql::server::service_name, 'status'] |
119 |
| - $stop_unless = "grep 'PGPORT=${shell_escape($value)}' /etc/sysconfig/pgsql/postgresql" |
120 |
| - exec { "postgresql_stop_${name}": |
121 |
| - command => $stop_command, |
122 |
| - onlyif => $stop_onlyif, |
123 |
| - unless => $stop_unless, |
124 |
| - path => '/sbin:/bin:/usr/bin:/usr/local/bin', |
125 |
| - require => File['/etc/sysconfig/pgsql/postgresql'], |
126 |
| - } |
127 |
| - -> augeas { 'override PGPORT in /etc/sysconfig/pgsql/postgresql': |
128 |
| - lens => 'Shellvars.lns', |
129 |
| - incl => '/etc/sysconfig/pgsql/postgresql', |
130 |
| - context => '/files/etc/sysconfig/pgsql/postgresql', |
131 |
| - changes => "set PGPORT ${value}", |
132 |
| - require => File['/etc/sysconfig/pgsql/postgresql'], |
133 |
| - notify => Class['postgresql::server::service'], |
134 |
| - before => Class['postgresql::server::reload'], |
135 |
| - } |
136 |
| - } elsif $name == 'data_directory' { |
137 |
| - # We need to force postgresql to stop before updating the data directory |
138 |
| - # otherwise init script breaks |
139 |
| - $stop_command = ['service', $postgresql::server::service_name, 'stop'] |
140 |
| - $stop_onlyif = ['service', $postgresql::server::service_name, 'status'] |
141 |
| - $stop_unless = [['grep', "PGDATA=${value}", '/etc/sysconfig/pgsql/postgresql']] |
142 |
| - exec { "postgresql_${name}": |
143 |
| - command => $stop_command, |
144 |
| - onlyif => $stop_onlyif, |
145 |
| - unless => $stop_unless, |
146 |
| - path => '/sbin:/bin:/usr/bin:/usr/local/bin', |
147 |
| - require => File['/etc/sysconfig/pgsql/postgresql'], |
148 |
| - } |
149 |
| - -> augeas { 'override PGDATA in /etc/sysconfig/pgsql/postgresql': |
150 |
| - lens => 'Shellvars.lns', |
151 |
| - incl => '/etc/sysconfig/pgsql/postgresql', |
152 |
| - context => '/files/etc/sysconfig/pgsql/postgresql', |
153 |
| - changes => "set PGDATA ${value}", |
154 |
| - require => File['/etc/sysconfig/pgsql/postgresql'], |
155 |
| - notify => Class['postgresql::server::service'], |
156 |
| - before => Class['postgresql::server::reload'], |
157 |
| - } |
158 |
| - } |
159 |
| - } |
160 |
| - |
161 | 90 | postgresql_conf { $name:
|
162 | 91 | ensure => $ensure,
|
163 | 92 | target => $target,
|
|
0 commit comments