From 9aebc4fbfe8ba38a244b2e14b26dd0f3cfa2586d Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Thu, 20 Nov 2014 23:09:28 -0500 Subject: [PATCH] MODULES-1485 Reverted to default behavior for Debian systems as pg_config should not be overridden --- README.md | 2 +- manifests/lib/devel.pp | 4 ++-- manifests/params.pp | 6 ++++++ spec/unit/classes/lib/devel_spec.rb | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a0bf04c..f73b541 100644 --- a/README.md +++ b/README.md @@ -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-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. diff --git a/manifests/lib/devel.pp b/manifests/lib/devel.pp index aa6aae3..5f1ad1c 100644 --- a/manifests/lib/devel.pp +++ b/manifests/lib/devel.pp @@ -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", } diff --git a/manifests/params.pp b/manifests/params.pp index 42c2ed7..a918fb1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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 diff --git a/spec/unit/classes/lib/devel_spec.rb b/spec/unit/classes/lib/devel_spec.rb index 45ddaef..17aa7f2 100644 --- a/spec/unit/classes/lib/devel_spec.rb +++ b/spec/unit/classes/lib/devel_spec.rb @@ -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') }