From 48396f5729bedd3730c256fd6167edd60c9244fe Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Thu, 20 Feb 2014 21:45:13 +0000 Subject: [PATCH] This fixes this test to work in the face of oppressive SELinux! --- spec/acceptance/server/tablespace_spec.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spec/acceptance/server/tablespace_spec.rb b/spec/acceptance/server/tablespace_spec.rb index b5f8e12..e2f36d8 100644 --- a/spec/acceptance/server/tablespace_spec.rb +++ b/spec/acceptance/server/tablespace_spec.rb @@ -10,7 +10,7 @@ describe 'postgresql::server::tablespace:' do pp = <<-EOS.unindent class { 'postgresql::server': } - file { '/tmp/pg_tablespaces': + file { '/tmp/postgres/pg_tablespaces': ensure => 'directory', owner => 'postgres', group => 'postgres', @@ -18,7 +18,7 @@ describe 'postgresql::server::tablespace:' do } postgresql::server::tablespace { 'tablespace1': - location => '/tmp/pg_tablespaces/space1', + location => '/tmp/postgres/pg_tablespaces/space1', } postgresql::server::database { 'tablespacedb1': encoding => 'utf8', @@ -34,7 +34,7 @@ describe 'postgresql::server::tablespace:' do password_hash => postgresql_password('spcuser', 'spcuser'), } postgresql::server::tablespace { 'tablespace2': - location => '/tmp/pg_tablespaces/space2', + location => '/tmp/postgres/pg_tablespaces/space2', owner => 'spcuser', } postgresql::server::database { 'tablespacedb3': @@ -43,6 +43,13 @@ describe 'postgresql::server::tablespace:' do } EOS + shell('mkdir -p /tmp/postgres') + # Apply appropriate selinux labels + if fact('osfamily') == 'RedHat' + if shell('getenforce').stdout == 'Enforcing' + shell('chcon -Rv --type=postgresql_db_t /tmp/postgres') + end + end apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_changes => true)