This fixes this test to work in the face of oppressive SELinux!

This commit is contained in:
Ashley Penney 2014-02-20 21:45:13 +00:00
parent e25efcfc21
commit 50fcd43883

View file

@ -10,7 +10,7 @@ describe 'postgresql::server::tablespace:' do
pp = <<-EOS.unindent pp = <<-EOS.unindent
class { 'postgresql::server': } class { 'postgresql::server': }
file { '/tmp/pg_tablespaces': file { '/tmp/postgres/pg_tablespaces':
ensure => 'directory', ensure => 'directory',
owner => 'postgres', owner => 'postgres',
group => 'postgres', group => 'postgres',
@ -18,7 +18,7 @@ describe 'postgresql::server::tablespace:' do
} }
postgresql::server::tablespace { 'tablespace1': postgresql::server::tablespace { 'tablespace1':
location => '/tmp/pg_tablespaces/space1', location => '/tmp/postgres/pg_tablespaces/space1',
} }
postgresql::server::database { 'tablespacedb1': postgresql::server::database { 'tablespacedb1':
encoding => 'utf8', encoding => 'utf8',
@ -34,7 +34,7 @@ describe 'postgresql::server::tablespace:' do
password_hash => postgresql_password('spcuser', 'spcuser'), password_hash => postgresql_password('spcuser', 'spcuser'),
} }
postgresql::server::tablespace { 'tablespace2': postgresql::server::tablespace { 'tablespace2':
location => '/tmp/pg_tablespaces/space2', location => '/tmp/postgres/pg_tablespaces/space2',
owner => 'spcuser', owner => 'spcuser',
} }
postgresql::server::database { 'tablespacedb3': postgresql::server::database { 'tablespacedb3':
@ -43,6 +43,13 @@ describe 'postgresql::server::tablespace:' do
} }
EOS 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_failures => true)
apply_manifest(pp, :catch_changes => true) apply_manifest(pp, :catch_changes => true)