Skip to content

Commit a386c38

Browse files
author
Ashley Penney
committed
Merge pull request puppetlabs#433 from apenney/fix-selinux-tests
Add workaround for selinux.
2 parents 5d4ecb1 + 5735eea commit a386c38

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,14 @@ Current it is only actively tested with the following operating systems:
856856

857857
Although patches are welcome for making it work with other OS distros, it is considered best effort.
858858

859+
### All versions of RHEL/Centos
860+
861+
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:
862+
863+
```
864+
# semanage port -a -t postgresql_port_t -p tcp $customport
865+
```
866+
859867
### RHEL7
860868

861869
Currently the following features are unsupported:

spec/acceptance/server_spec.rb

+21
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,27 @@ class { "postgresql::server":
253253
apply_manifest("class { 'postgresql::server': ensure => absent }", :catch_failures => true)
254254
end
255255

256+
it 'sets up selinux' do
257+
pp = <<-EOS
258+
if $::osfamily == 'RedHat' and $::selinux == 'true' {
259+
$semanage_package = $::operatingsystemmajrelease ? {
260+
'5' => 'policycoreutils',
261+
default => 'policycoreutils-python',
262+
}
263+
264+
package { $semanage_package: ensure => installed }
265+
exec { 'set_postgres':
266+
command => 'semanage port -a -t postgresql_port_t -p tcp 5433',
267+
path => '/bin:/usr/bin/:/sbin:/usr/sbin',
268+
subscribe => Package[$semanage_package],
269+
refreshonly => true,
270+
}
271+
EOS
272+
273+
apply_manifest(pp, :catch_failures => true)
274+
end
275+
276+
256277
context 'test installing postgresql with alternate port' do
257278
it 'perform installation and make sure it is idempotent' do
258279
pp = <<-EOS.unindent

0 commit comments

Comments
 (0)