From 0c4f2a96470cf0ce211757422b2db9f96e9ada07 Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Tue, 8 Jul 2014 13:58:28 +0100 Subject: [PATCH] Fix Fedora support by configuring systemd, not /etc/sysconfig --- manifests/server/config.pp | 2 +- manifests/server/config_entry.pp | 2 +- spec/unit/defines/server/config_entry_spec.rb | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/manifests/server/config.pp b/manifests/server/config.pp index 4526a0a..6b94356 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -101,7 +101,7 @@ class postgresql::server::config { # RedHat-based systems hardcode some PG* variables in the init script, and need to be overriden # in /etc/sysconfig/pgsql/postgresql. Create a blank file so we can manage it with augeas later. - if ($::osfamily == 'RedHat') and ($::operatingsystemrelease !~ /^7/) { + if ($::osfamily == 'RedHat') and ($::operatingsystemrelease !~ /^7/) and ($::operatingsystem != 'Fedora') { file { '/etc/sysconfig/pgsql/postgresql': ensure => present, replace => false, diff --git a/manifests/server/config_entry.pp b/manifests/server/config_entry.pp index 0ddf27c..1b4eb37 100644 --- a/manifests/server/config_entry.pp +++ b/manifests/server/config_entry.pp @@ -30,7 +30,7 @@ define postgresql::server::config_entry ( # have to create a systemd override for the port or update the sysconfig # file. if $::osfamily == 'RedHat' { - if $::operatingsystemrelease =~ /^7/ { + if $::operatingsystemrelease =~ /^7/ or $::operatingsystem == 'Fedora' { if $name == 'port' { file { 'systemd-port-override': ensure => present, diff --git a/spec/unit/defines/server/config_entry_spec.rb b/spec/unit/defines/server/config_entry_spec.rb index 1bf447c..6015e36 100644 --- a/spec/unit/defines/server/config_entry_spec.rb +++ b/spec/unit/defines/server/config_entry_spec.rb @@ -62,6 +62,25 @@ describe 'postgresql::server::config_entry', :type => :define do end let(:params) {{ :ensure => 'present', :name => 'port', :value => '5432' }} + it 'stops postgresql and changes the port' do + is_expected.to contain_file('systemd-port-override') + is_expected.to contain_exec('restart-systemd') + end + end + context 'fedora 19' do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystem => 'Fedora', + :operatingsystemrelease => '19', + :kernel => 'Linux', + :concat_basedir => tmpfilename('contrib'), + :id => 'root', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + } + end + let(:params) {{ :ensure => 'present', :name => 'port', :value => '5432' }} + it 'stops postgresql and changes the port' do is_expected.to contain_file('systemd-port-override') is_expected.to contain_exec('restart-systemd')