Merge pull request #534 from cyberious/MODULES-1485

MODULES-1485 Reverted to default behavior for Debian systems as pg_config should not be overridden
This commit is contained in:
Morgan Haskel 2014-11-21 14:56:02 -05:00
commit 530a01a5c5
4 changed files with 10 additions and 4 deletions

View file

@ -506,7 +506,7 @@ Override for the `ensure` parameter during package installation. Defaults to `pr
Overrides the default package name for the distribution you are installing to. Defaults to `postgresql-devel` or `postgresql<version>-devel` depending on your distro.
####`link_pg_config`
By default, if the bin directory used by the PostgreSQL package is not `/usr/bin` or `/usr/local/bin`,
By default on all but Debian systems, if the bin directory used by the PostgreSQL package is not `/usr/bin` or `/usr/local/bin`,
this class will symlink `pg_config` from the package's bin dir into `/usr/bin`. Set `link_pg_config` to
false to disable this behavior.

View file

@ -3,7 +3,7 @@
class postgresql::lib::devel(
$package_name = $postgresql::params::devel_package_name,
$package_ensure = 'present',
$link_pg_config = true
$link_pg_config = $postgresql::params::link_pg_config
) inherits postgresql::params {
validate_string($package_name)
@ -16,7 +16,7 @@ class postgresql::lib::devel(
if $link_pg_config {
if ( $postgresql::params::bindir != '/usr/bin' and $postgresql::params::bindir != '/usr/local/bin') {
file {'/usr/bin/pg_config':
file { '/usr/bin/pg_config':
ensure => link,
target => "${postgresql::params::bindir}/pg_config",
}

View file

@ -20,6 +20,7 @@ class postgresql::params inherits postgresql::globals {
# Amazon Linux's OS Family is 'Linux', operating system 'Amazon'.
case $::osfamily {
'RedHat', 'Linux': {
$link_pg_config = true
$user = pick($user, 'postgres')
$group = pick($group, 'postgres')
$needs_initdb = pick($needs_initdb, true)
@ -73,6 +74,7 @@ class postgresql::params inherits postgresql::globals {
}
'Archlinux': {
$link_pg_config = true
$needs_initdb = pick($needs_initdb, true)
$user = pick($user, 'postgres')
$group = pick($group, 'postgres')
@ -101,6 +103,7 @@ class postgresql::params inherits postgresql::globals {
}
'Debian': {
$link_pg_config = false
$user = pick($user, 'postgres')
$group = pick($group, 'postgres')
@ -143,6 +146,7 @@ class postgresql::params inherits postgresql::globals {
}
'FreeBSD': {
$link_pg_config = true
$user = pick($user, 'pgsql')
$group = pick($group, 'pgsql')
@ -166,6 +170,7 @@ class postgresql::params inherits postgresql::globals {
}
'Suse': {
$link_pg_config = true
$user = pick($user, 'postgres')
$group = pick($group, 'postgres')
@ -189,6 +194,7 @@ class postgresql::params inherits postgresql::globals {
}
default: {
$link_pg_config = true
$psql_path = pick($psql_path, "${bindir}/psql")
# Since we can't determine defaults on our own, we rely on users setting

View file

@ -11,7 +11,7 @@ describe 'postgresql::lib::devel', :type => :class do
it { is_expected.to contain_class("postgresql::lib::devel") }
describe 'link pg_config to /usr/bin' do
it { should contain_file('/usr/bin/pg_config') \
it { should_not contain_file('/usr/bin/pg_config') \
.with_ensure('link') \
.with_target('/usr/lib/postgresql/8.4/bin/pg_config')
}