Merge pull request #716 from hunner/fix_95

Add default postgis version for 9.5
This commit is contained in:
David Schmitt 2016-01-28 10:22:28 +00:00
commit 8a84929b37
3 changed files with 28 additions and 11 deletions

View file

@ -132,8 +132,9 @@ class postgresql::globals (
'91' => '1.5',
'9.2' => '2.0',
'9.3' => '2.1',
'9.4' => '2.1',
'93' => '2.1',
'9.4' => '2.1',
'9.5' => '2.2',
default => undef,
}
$globals_postgis_version = $postgis_version ? {

View file

@ -76,15 +76,15 @@ class postgresql::params inherits postgresql::globals {
$perl_package_name = pick($perl_package_name, 'perl-DBD-Pg')
$python_package_name = pick($python_package_name, 'python-psycopg2')
$postgis_package_name = pick(
$postgis_package_name,
$::operatingsystemrelease ? {
/^5\./ => 'postgis',
default => versioncmp($postgis_version, '2') ? {
'-1' => "postgis${package_version}",
default => "postgis2_${package_version}",}
}
)
if $postgresql::globals::postgis_package_name {
$postgis_package_name = $postgresql::globals::postgis_package_name
} elsif $::operatingsystemrelease =~ /^5\./ {
$postgis_package_name = 'postgis'
} elsif $postgis_version and versioncmp($postgis_version, '2') < 0 {
$postgis_package_name = "postgis${package_version}"
} else {
$postgis_package_name = "postgis2_${package_version}"
}
}
'Archlinux': {
@ -141,7 +141,7 @@ class postgresql::params inherits postgresql::globals {
$client_package_name = pick($client_package_name, "postgresql-client-${version}")
$server_package_name = pick($server_package_name, "postgresql-${version}")
$contrib_package_name = pick($contrib_package_name, "postgresql-contrib-${version}")
if versioncmp($postgis_version, '2') < 0 {
if $postgis_version and versioncmp($postgis_version, '2') < 0 {
$postgis_package_name = pick($postgis_package_name, "postgresql-${version}-postgis")
} else {
$postgis_package_name = pick($postgis_package_name, "postgresql-${version}-postgis-${postgis_version}")

View file

@ -5,6 +5,7 @@ describe 'postgresql::server', :type => :class do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:lsbdistid => 'Debian',
:operatingsystemrelease => '6.0',
:concat_basedir => tmpfilename('server'),
:kernel => 'Linux',
@ -139,4 +140,19 @@ describe 'postgresql::server', :type => :class do
is_expected.to contain_exec('postgresql_initdb')
end
end
describe 'postgresql_version' do
let(:pre_condition) do
<<-EOS
class { 'postgresql::globals':
manage_package_repo => true,
version => '99.5',
before => Class['postgresql::server'],
}
EOS
end
it 'contains the correct package version' do
is_expected.to contain_class('postgresql::repo').with_version('99.5')
end
end
end