Merge pull request #172 from dprince/python_module

Adds new postgresql::python module.
This commit is contained in:
Ken Barber 2013-04-22 14:40:38 -07:00
commit 08b7bdba49
3 changed files with 61 additions and 0 deletions

View file

@ -134,6 +134,7 @@ class postgresql::params(
}
$service_status = undef
$python_package_name="python-psycopg2"
}
'Debian': {
@ -166,6 +167,7 @@ class postgresql::params(
$datadir = pick($custom_datadir, "/var/lib/postgresql/${version}/main")
$confdir = pick($custom_confdir, "/etc/postgresql/${version}/main")
$service_status = "/etc/init.d/${service_name} status | /bin/egrep -q 'Running clusters: .+|online'"
$python_package_name = "python-psycopg2"
}
default: {

18
manifests/python.pp Normal file
View file

@ -0,0 +1,18 @@
# Class: postgresql::python
# This class installs the python libs for postgresql.
#
# Parameters:
# [*ensure*] - ensure state for package.
# can be specified as version.
# [*package_name*] - name of package
class postgresql::python(
$package_name = $postgresql::params::python_package_name,
$package_ensure = 'present'
) inherits postgresql::params {
package { 'python-psycopg2':
ensure => $package_ensure,
name => $package_name,
}
}

View file

@ -0,0 +1,41 @@
require 'spec_helper'
describe 'postgresql::python', :type => :class do
describe 'on a redhat based os' do
let :facts do {
:osfamily => 'RedHat',
:postgres_default_version => 'foo',
}
end
it { should contain_package('python-psycopg2').with(
:name => 'python-psycopg2',
:ensure => 'present'
)}
end
describe 'on a debian based os' do
let :facts do {
:osfamily => 'Debian',
:postgres_default_version => 'foo',
}
end
it { should contain_package('python-psycopg2').with(
:name => 'python-psycopg2',
:ensure => 'present'
)}
end
describe 'on any other os' do
let :facts do {
:osfamily => 'foo',
:postgres_default_version => 'foo',
}
end
it 'should fail' do
expect { subject }.to raise_error(/Unsupported osfamily: foo/)
end
end
end