Merge pull request #634 from DavidS/add-plpython-docs-classes
Add plpython and postgresql-docs classes
This commit is contained in:
commit
2f39ccd484
8 changed files with 235 additions and 87 deletions
28
README.md
28
README.md
|
@ -131,10 +131,12 @@ Classes:
|
|||
* [postgresql::globals](#class-postgresqlglobals)
|
||||
* [postgresql::lib::devel](#class-postgresqllibdevel)
|
||||
* [postgresql::lib::java](#class-postgresqllibjava)
|
||||
* [postgresql::lib::docs](#class-postgresqllibdocs)
|
||||
* [postgresql::lib::perl](#class-postgresqllibperl)
|
||||
* [postgresql::lib::python](#class-postgresqllibpython)
|
||||
* [postgresql::server](#class-postgresqlserver)
|
||||
* [postgresql::server::plperl](#class-postgresqlserverplperl)
|
||||
* [postgresql::server::plpython](#class-postgresqlserverplpython)
|
||||
* [postgresql::server::contrib](#class-postgresqlservercontrib)
|
||||
* [postgresql::server::postgis](#class-postgresqlserverpostgis)
|
||||
|
||||
|
@ -205,12 +207,18 @@ 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.
|
||||
|
||||
####`docs_package_name`
|
||||
This setting can be used to override the default postgresql docs 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.
|
||||
|
||||
####`plpython_package_name`
|
||||
This setting can be used to override the default postgresql PL/python package name. If not specified, the module will use whatever package name is the default for your OS distro.
|
||||
|
||||
####`python_package_name`
|
||||
This setting can be used to override the default postgresql Python package name. If not specified, the module will use whatever package name is the default for your OS distro.
|
||||
|
||||
|
@ -315,6 +323,9 @@ Value to pass through to the `package` resource when creating the server instanc
|
|||
####`plperl_package_name`
|
||||
This sets the default package name for the PL/Perl extension. Defaults to utilising the operating system default.
|
||||
|
||||
####`plpython_package_name`
|
||||
This sets the default package name for the PL/Python extension. Defaults to utilising the operating system default.
|
||||
|
||||
####`service_manage`
|
||||
This setting selects whether Puppet should manage the service. Defaults to `true`.
|
||||
|
||||
|
@ -456,6 +467,15 @@ The name of the postgresql java package.
|
|||
####`package_ensure`
|
||||
The ensure parameter passed on to postgresql java package resource.
|
||||
|
||||
###Class: postgresql::lib::docs
|
||||
This class installs postgresql bindings for Postgres-Docs. Alter the following parameters if you have a custom version you would like to install (Note: don't forget to make sure to add any necessary yum or apt repositories if specifying a custom version):
|
||||
|
||||
####`package_name`
|
||||
The name of the postgresql docs package.
|
||||
|
||||
####`package_ensure`
|
||||
The ensure parameter passed on to postgresql docs package resource.
|
||||
|
||||
|
||||
###Class: postgresql::lib::perl
|
||||
This class installs the postgresql Perl libraries. For customer requirements you can customise the following parameters:
|
||||
|
@ -466,6 +486,14 @@ The name of the postgresql perl package.
|
|||
####`package_ensure`
|
||||
The ensure parameter passed on to postgresql perl package resource.
|
||||
|
||||
###Class: postgresql::server::plpython
|
||||
This class installs the PL/Python procedural language for postgresql.
|
||||
|
||||
####`package_name`
|
||||
The name of the postgresql PL/Python package.
|
||||
|
||||
####`package_ensure`
|
||||
The ensure parameter passed on to postgresql PL/Python package resource.
|
||||
|
||||
###Class: postgresql::lib::python
|
||||
This class installs the postgresql Python libraries. For customer requirements you can customise the following parameters:
|
||||
|
|
|
@ -6,8 +6,10 @@ class postgresql::globals (
|
|||
$contrib_package_name = undef,
|
||||
$devel_package_name = undef,
|
||||
$java_package_name = undef,
|
||||
$docs_package_name = undef,
|
||||
$perl_package_name = undef,
|
||||
$plperl_package_name = undef,
|
||||
$plpython_package_name = undef,
|
||||
$python_package_name = undef,
|
||||
$postgis_package_name = undef,
|
||||
|
||||
|
@ -49,7 +51,7 @@ class postgresql::globals (
|
|||
$manage_pg_ident_conf = undef,
|
||||
$manage_recovery_conf = undef,
|
||||
|
||||
$manage_package_repo = undef
|
||||
$manage_package_repo = undef,
|
||||
) {
|
||||
# We are determining this here, because it is needed by the package repo
|
||||
# class.
|
||||
|
|
16
manifests/lib/docs.pp
Normal file
16
manifests/lib/docs.pp
Normal file
|
@ -0,0 +1,16 @@
|
|||
# This class installs the postgresql-docs See README.md for more
|
||||
# details.
|
||||
class postgresql::lib::docs (
|
||||
$package_name = $postgresql::params::docs_package_name,
|
||||
$package_ensure = 'present',
|
||||
) inherits postgresql::params {
|
||||
|
||||
validate_string($package_name)
|
||||
|
||||
package { 'postgresql-docs':
|
||||
ensure => $package_ensure,
|
||||
name => $package_name,
|
||||
tag => 'postgresql',
|
||||
}
|
||||
|
||||
}
|
|
@ -35,7 +35,9 @@ class postgresql::params inherits postgresql::globals {
|
|||
$contrib_package_name = pick($contrib_package_name,'postgresql-contrib')
|
||||
$devel_package_name = pick($devel_package_name, 'postgresql-devel')
|
||||
$java_package_name = pick($java_package_name, 'postgresql-jdbc')
|
||||
$docs_package_name = pick($docs_package_name, 'postgresql-docs')
|
||||
$plperl_package_name = pick($plperl_package_name, 'postgresql-plperl')
|
||||
$plpython_package_name = pick($plpython_package_name, 'postgresql-plpython')
|
||||
$service_name = pick($service_name, 'postgresql')
|
||||
$bindir = pick($bindir, '/usr/bin')
|
||||
$datadir = $::operatingsystem ? {
|
||||
|
@ -49,7 +51,9 @@ class postgresql::params inherits postgresql::globals {
|
|||
$contrib_package_name = pick($contrib_package_name,"postgresql${package_version}-contrib")
|
||||
$devel_package_name = pick($devel_package_name, "postgresql${package_version}-devel")
|
||||
$java_package_name = pick($java_package_name, "postgresql${package_version}-jdbc")
|
||||
$docs_package_name = pick($docs_package_name, "postgresql${package_version}-docs")
|
||||
$plperl_package_name = pick($plperl_package_name, "postgresql${package_version}-plperl")
|
||||
$plpython_package_name = pick($plpython_package_name, "postgresql${package_version}-plpython")
|
||||
$service_name = pick($service_name, "postgresql-${version}")
|
||||
$bindir = pick($bindir, "/usr/pgsql-${version}/bin")
|
||||
$datadir = $::operatingsystem ? {
|
||||
|
@ -93,6 +97,7 @@ class postgresql::params inherits postgresql::globals {
|
|||
$contrib_package_name = pick($contrib_package_name,'undef')
|
||||
# Archlinux postgresql package provides plperl
|
||||
$plperl_package_name = pick($plperl_package_name, 'undef')
|
||||
$plpython_package_name = pick($plpython_package_name, 'undef')
|
||||
$service_name = pick($service_name, 'postgresql')
|
||||
$bindir = pick($bindir, '/usr/bin')
|
||||
$datadir = pick($datadir, '/var/lib/postgres/data')
|
||||
|
@ -138,6 +143,7 @@ class postgresql::params inherits postgresql::globals {
|
|||
$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}")
|
||||
$plpython_package_name = pick($plpython_package_name, "postgresql-plpython-${version}")
|
||||
$python_package_name = pick($python_package_name, 'python-psycopg2')
|
||||
|
||||
$bindir = pick($bindir, "/usr/lib/postgresql/${version}/bin")
|
||||
|
|
|
@ -7,6 +7,7 @@ class postgresql::server (
|
|||
$package_ensure = $postgresql::params::package_ensure,
|
||||
|
||||
$plperl_package_name = $postgresql::params::plperl_package_name,
|
||||
$plpython_package_name = $postgresql::params::plpython_package_name,
|
||||
|
||||
$service_ensure = $postgresql::params::service_ensure,
|
||||
$service_enable = $postgresql::params::service_enable,
|
||||
|
|
19
manifests/server/plpython.pp
Normal file
19
manifests/server/plpython.pp
Normal file
|
@ -0,0 +1,19 @@
|
|||
# This class installs the PL/Python procedural language for postgresql. See
|
||||
# README.md for more details.
|
||||
class postgresql::server::plpython(
|
||||
$package_ensure = 'present',
|
||||
$package_name = $postgresql::server::plpython_package_name,
|
||||
) {
|
||||
package { 'postgresql-plpython':
|
||||
ensure => $package_ensure,
|
||||
name => $package_name,
|
||||
tag => 'postgresql',
|
||||
}
|
||||
|
||||
anchor { 'postgresql::server::plpython::start': }->
|
||||
Class['postgresql::server::install']->
|
||||
Package['postgresql-plpython']->
|
||||
Class['postgresql::server::service']->
|
||||
anchor { 'postgresql::server::plpython::end': }
|
||||
|
||||
}
|
29
spec/unit/classes/lib/pgdocs_spec.rb
Normal file
29
spec/unit/classes/lib/pgdocs_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::lib::docs', :type => :class do
|
||||
|
||||
describe 'on a redhat based os' do
|
||||
let :facts do {
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemrelease => '6.4',
|
||||
}
|
||||
end
|
||||
it { is_expected.to contain_package('postgresql-docs').with(
|
||||
:name => 'postgresql-docs',
|
||||
:ensure => 'present',
|
||||
:tag => 'postgresql'
|
||||
)}
|
||||
describe 'when parameters are supplied' do
|
||||
let :params do
|
||||
{:package_ensure => 'latest', :package_name => 'somepackage'}
|
||||
end
|
||||
it { is_expected.to contain_package('postgresql-docs').with(
|
||||
:name => 'somepackage',
|
||||
:ensure => 'latest',
|
||||
:tag => 'postgresql'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
47
spec/unit/classes/server/plpython_spec.rb
Normal file
47
spec/unit/classes/server/plpython_spec.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::server::plpython', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'CentOS',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:concat_basedir => tmpfilename('plpython'),
|
||||
:kernel => 'Linux',
|
||||
:id => 'root',
|
||||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'postgresql::server': }"
|
||||
end
|
||||
|
||||
describe 'on RedHat with no parameters' do
|
||||
it { is_expected.to contain_class("postgresql::server::plpython") }
|
||||
it 'should create package' do
|
||||
is_expected.to contain_package('postgresql-plpython').with({
|
||||
:ensure => 'present',
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with parameters' do
|
||||
let :params do
|
||||
{
|
||||
:package_ensure => 'absent',
|
||||
:package_name => 'mypackage',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class("postgresql::server::plpython") }
|
||||
it 'should create package with correct params' do
|
||||
is_expected.to contain_package('postgresql-plpython').with({
|
||||
:ensure => 'absent',
|
||||
:name => 'mypackage',
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue