Skip to content

Commit 21001d5

Browse files
committed
(MODULES-630) Deprecate postgresql::server::version
Adjusting the version is explicitly done though the postgresql::globals class, as this affects many parts of the module. This parameter did not function correctly on systems that did not have a default, as described in the ticket.
1 parent 7fb35f5 commit 21001d5

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,6 @@ The following list are options that you can set in the `config_hash` parameter o
369369
####`ensure`
370370
This value default to `present`. When set to `absent` it will remove all packages, configuration and data so use this with extreme caution.
371371

372-
####`version`
373-
This will set the version of the PostgreSQL software to install. Defaults to your operating systems default.
374-
375372
####`postgres_password`
376373
This value defaults to `undef`, meaning the super user account in the postgres database is a user called `postgres` and this account does not have a password. If you provide this setting, the module will set the password for the `postgres` user to your specified value.
377374

manifests/server.pp

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
class postgresql::server (
33
$ensure = $postgresql::params::ensure,
44

5-
$version = $postgresql::params::version,
6-
75
$postgres_password = undef,
86

97
$package_name = $postgresql::params::server_package_name,
@@ -45,10 +43,17 @@
4543

4644
$manage_firewall = $postgresql::params::manage_firewall,
4745
$manage_pg_hba_conf = $postgresql::params::manage_pg_hba_conf,
48-
$firewall_supported = $postgresql::params::firewall_supported
46+
$firewall_supported = $postgresql::params::firewall_supported,
47+
48+
#Deprecated
49+
$version = $postgresql::params::version,
4950
) inherits postgresql::params {
5051
$pg = 'postgresql::server'
5152

53+
if $version != $postgresql::params::version {
54+
warning('Passing "version" to postgresql::server is deprecated; please use postgresql::globals instead.')
55+
}
56+
5257
if ($ensure == 'present' or $ensure == true) {
5358
# Reload has its own ordering, specified by other defines
5459
class { "${pg}::reload": require => Class["${pg}::install"] }

spec/acceptance/server_spec.rb

+21
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,27 @@ class { "postgresql::server": }
113113
end
114114
end
115115

116+
context 'test deprecating non-default version of postgresql to postgresql::server' do
117+
after :all do
118+
pp = <<-EOS.unindent
119+
class { 'postgresql::server':
120+
ensure => absent,
121+
version => '9.3',
122+
}
123+
EOS
124+
apply_manifest(pp, :catch_failures => true)
125+
end
126+
127+
it 'raises a warning' do
128+
pp = <<-EOS.unindent
129+
class { 'postgresql::server':
130+
version => '9.3',
131+
}
132+
EOS
133+
expect(apply_manifest(pp, :catch_failures => true).stderr).to match(/Passing "version" to postgresql::server is deprecated/i)
134+
end
135+
end
136+
116137
unless ((fact('osfamily') == 'RedHat' and fact('lsbmajdistrelease') == '5') ||
117138
fact('osfamily') == 'Debian')
118139

0 commit comments

Comments
 (0)