File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 134
134
}
135
135
136
136
$service_status = undef
137
+ $python_package_name =" python-psycopg2"
137
138
}
138
139
139
140
' Debian' : {
166
167
$datadir = pick($custom_datadir , " /var/lib/postgresql/${version} /main" )
167
168
$confdir = pick($custom_confdir , " /etc/postgresql/${version} /main" )
168
169
$service_status = " /etc/init.d/${service_name} status | /bin/egrep -q 'Running clusters: .+|online'"
170
+ $python_package_name = " python-psycopg2"
169
171
}
170
172
171
173
default: {
Original file line number Diff line number Diff line change
1
+ # Class: postgresql::python
2
+ # This class installs the python libs for postgresql.
3
+ #
4
+ # Parameters:
5
+ # [*ensure*] - ensure state for package.
6
+ # can be specified as version.
7
+ # [*package_name*] - name of package
8
+ class postgresql::python (
9
+ $package_name = $postgresql::params::python_package_name,
10
+ $package_ensure = ' present'
11
+ ) inherits postgresql::params {
12
+
13
+ package { 'python-psycopg2' :
14
+ ensure => $package_ensure ,
15
+ name => $package_name ,
16
+ }
17
+
18
+ }
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe 'postgresql::python' , :type => :class do
4
+
5
+ describe 'on a redhat based os' do
6
+ let :facts do {
7
+ :osfamily => 'RedHat' ,
8
+ :postgres_default_version => 'foo' ,
9
+ }
10
+ end
11
+ it { should contain_package ( 'python-psycopg2' ) . with (
12
+ :name => 'python-psycopg2' ,
13
+ :ensure => 'present'
14
+ ) }
15
+ end
16
+
17
+ describe 'on a debian based os' do
18
+ let :facts do {
19
+ :osfamily => 'Debian' ,
20
+ :postgres_default_version => 'foo' ,
21
+ }
22
+ end
23
+ it { should contain_package ( 'python-psycopg2' ) . with (
24
+ :name => 'python-psycopg2' ,
25
+ :ensure => 'present'
26
+ ) }
27
+ end
28
+
29
+ describe 'on any other os' do
30
+ let :facts do {
31
+ :osfamily => 'foo' ,
32
+ :postgres_default_version => 'foo' ,
33
+ }
34
+ end
35
+
36
+ it 'should fail' do
37
+ expect { subject } . to raise_error ( /Unsupported osfamily: foo/ )
38
+ end
39
+ end
40
+
41
+ end
You can’t perform that action at this time.
0 commit comments