Merge pull request #433 from apenney/fix-selinux-tests

Add workaround for selinux.
This commit is contained in:
Ashley Penney 2014-06-24 11:11:29 -04:00
commit a386c388d0
2 changed files with 29 additions and 0 deletions

View file

@ -856,6 +856,14 @@ Current it is only actively tested with the following operating systems:
Although patches are welcome for making it work with other OS distros, it is considered best effort.
### All versions of RHEL/Centos
If you have selinux enabled you must add any custom ports you use to the postgresql_port_t context. You can do this as follows:
```
# semanage port -a -t postgresql_port_t -p tcp $customport
```
### RHEL7
Currently the following features are unsupported:

View file

@ -253,6 +253,27 @@ describe 'server on alternate port:', :unless => UNSUPPORTED_PLATFORMS.include?(
apply_manifest("class { 'postgresql::server': ensure => absent }", :catch_failures => true)
end
it 'sets up selinux' do
pp = <<-EOS
if $::osfamily == 'RedHat' and $::selinux == 'true' {
$semanage_package = $::operatingsystemmajrelease ? {
'5' => 'policycoreutils',
default => 'policycoreutils-python',
}
package { $semanage_package: ensure => installed }
exec { 'set_postgres':
command => 'semanage port -a -t postgresql_port_t -p tcp 5433',
path => '/bin:/usr/bin/:/sbin:/usr/sbin',
subscribe => Package[$semanage_package],
refreshonly => true,
}
EOS
apply_manifest(pp, :catch_failures => true)
end
context 'test installing postgresql with alternate port' do
it 'perform installation and make sure it is idempotent' do
pp = <<-EOS.unindent