Merge pull request #401 from cfeskens/add-perl-support

Add class postgresql::lib::perl for perl support
This commit is contained in:
Ashley Penney 2014-04-17 13:27:00 -04:00
commit a29d038287
6 changed files with 81 additions and 0 deletions

View file

@ -215,6 +215,7 @@ Classes:
* [postgresql::globals](#class-postgresqlglobals)
* [postgresql::lib::devel](#class-postgresqllibdevel)
* [postgresql::lib::java](#class-postgresqllibjava)
* [postgresql::lib::perl](#class-postgresqllibperl)
* [postgresql::lib::python](#class-postgresqllibpython)
* [postgresql::server](#class-postgresqlserver)
* [postgresql::server::plperl](#class-postgresqlserverplperl)
@ -278,6 +279,9 @@ This setting can be used to override the default postgresql devel package name.
####`java_package_name`
This setting can be used to override the default postgresql java package name. If not specified, the module will use whatever package name is the default for your OS distro.
####`perl_package_name`
This setting can be used to override the default postgresql Perl package name. If not specified, the module will use whatever package name is the default for your OS distro.
####`plperl_package_name`
This setting can be used to override the default postgresql PL/perl package name. If not specified, the module will use whatever package name is the default for your OS distro.
@ -497,6 +501,16 @@ The name of the postgresql java package.
The ensure parameter passed on to postgresql java package resource.
###Class: postgresql::lib::perl
This class installs the postgresql Perl libraries. For customer requirements you can customise the following parameters:
####`package_name`
The name of the postgresql perl package.
####`package_ensure`
The ensure parameter passed on to postgresql perl package resource.
###Class: postgresql::lib::python
This class installs the postgresql Python libraries. For customer requirements you can customise the following parameters:

View file

@ -8,6 +8,7 @@ class postgresql::globals (
$contrib_package_name = undef,
$devel_package_name = undef,
$java_package_name = undef,
$perl_package_name = undef,
$plperl_package_name = undef,
$python_package_name = undef,
$postgis_package_name = undef,

13
manifests/lib/perl.pp Normal file
View file

@ -0,0 +1,13 @@
# This class installs the perl libs for postgresql. See README.md for more
# details.
class postgresql::lib::perl(
$package_name = $postgresql::params::perl_package_name,
$package_ensure = 'present'
) inherits postgresql::params {
package { 'perl-DBD-Pg':
ensure => $package_ensure,
name => $package_name,
}
}

View file

@ -56,6 +56,7 @@ class postgresql::params inherits postgresql::globals {
$psql_path = pick($psql_path, "${bindir}/psql")
$service_status = $service_status
$perl_package_name = pick($perl_package_name, 'perl-DBD-Pg')
$python_package_name = pick($python_package_name, 'python-psycopg2')
$postgis_package_name = pick(
@ -95,6 +96,8 @@ class postgresql::params inherits postgresql::globals {
$service_status = $service_status
$python_package_name = pick($python_package_name, 'python-psycopg2')
# Archlinux does not have a perl::DBD::Pg package
$perl_package_name = pick($perl_package_name, 'undef')
}
'Debian': {
@ -128,6 +131,7 @@ class postgresql::params inherits postgresql::globals {
)
$devel_package_name = pick($devel_package_name, 'libpq-dev')
$java_package_name = pick($java_package_name, 'libpostgresql-jdbc-java')
$perl_package_name = pick($perl_package_name, 'libdbd-pg-perl')
$plperl_package_name = pick($plperl_package_name, "postgresql-plperl-${version}")
$python_package_name = pick($python_package_name, 'python-psycopg2')
@ -149,6 +153,7 @@ class postgresql::params inherits postgresql::globals {
$contrib_package_name = pick($contrib_package_name, "databases/postgresql${version}-contrib")
$devel_package_name = pick($devel_package_name, 'databases/postgresql-libpqxx3')
$java_package_name = pick($java_package_name, 'databases/postgresql-jdbc')
$perl_package_name = pick($plperl_package_name, 'databases/p5-DBD-Pg')
$plperl_package_name = pick($plperl_package_name, "databases/postgresql${version}-plperl")
$python_package_name = pick($python_package_name, 'databases/py-psycopg2')

View file

@ -0,0 +1,17 @@
require 'spec_helper_acceptance'
describe 'postgresql::lib::perl:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
after :all do
# Cleanup after tests have ran
apply_manifest("class { 'postgresql::lib::perl': package_ensure => purged }", :catch_failures => true)
end
it 'test loading class with no parameters' do
pp = <<-EOS.unindent
class { 'postgresql::lib::perl': }
EOS
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
end

View file

@ -0,0 +1,31 @@
require 'spec_helper'
describe 'postgresql::lib::perl', :type => :class do
describe 'on a redhat based os' do
let :facts do {
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6.4',
}
end
it { should contain_package('perl-DBD-Pg').with(
:name => 'perl-DBD-Pg',
:ensure => 'present'
)}
end
describe 'on a debian based os' do
let :facts do {
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6.0',
}
end
it { should contain_package('perl-DBD-Pg').with(
:name => 'libdbd-pg-perl',
:ensure => 'present'
)}
end
end