File tree 5 files changed +37
-11
lines changed
5 files changed +37
-11
lines changed Original file line number Diff line number Diff line change 22
22
cwd => $module_workdir ,
23
23
}
24
24
25
+ if $::osfamily == ' RedHat' and $::selinux == true {
26
+ $seltype = ' postgresql_db_t'
27
+ $logdir_type = ' postgresql_log_t'
28
+ }
29
+
30
+ else {
31
+ $seltype = undef
32
+ $logdir_type = undef
33
+ }
34
+
25
35
# Make sure the data directory exists, and has the correct permissions.
26
36
file { $datadir:
27
- ensure => directory ,
28
- owner => $user ,
29
- group => $group ,
30
- mode => ' 0700' ,
37
+ ensure => directory ,
38
+ owner => $user ,
39
+ group => $group ,
40
+ mode => ' 0700' ,
41
+ seltype => $seltype ,
31
42
}
32
43
33
44
if ($xlogdir ) {
34
45
# Make sure the xlog directory exists, and has the correct permissions.
35
46
file { $xlogdir:
36
- ensure => directory ,
37
- owner => $user ,
38
- group => $group ,
39
- mode => ' 0700' ,
47
+ ensure => directory ,
48
+ owner => $user ,
49
+ group => $group ,
50
+ mode => ' 0700' ,
51
+ seltype => $seltype ,
40
52
}
41
53
}
42
54
43
55
if ($logdir ) {
44
56
# Make sure the log directory exists, and has the correct permissions.
45
57
file { $logdir:
46
- ensure => directory ,
47
- owner => $user ,
48
- group => $group ,
58
+ ensure => directory ,
59
+ owner => $user ,
60
+ group => $group ,
61
+ seltype => $logdir_type ,
49
62
}
50
63
}
51
64
Original file line number Diff line number Diff line change 15
15
:kernel => 'Linux' ,
16
16
:id => 'root' ,
17
17
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
18
+ :selinux => true ,
18
19
}
19
20
end
20
21
it 'should have the correct systemd-override file' do
@@ -62,6 +63,7 @@ class { 'postgresql::server': }
62
63
:kernel => 'Linux' ,
63
64
:id => 'root' ,
64
65
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
66
+ :selinux => true ,
65
67
}
66
68
end
67
69
it 'should have the correct systemd-override file' do
@@ -117,6 +119,7 @@ class { 'postgresql::server': }
117
119
:kernel => 'Linux' ,
118
120
:id => 'root' ,
119
121
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
122
+ :selinux => false ,
120
123
}
121
124
end
122
125
it 'should have the correct systemd-override file' do
Original file line number Diff line number Diff line change 14
14
:kernel => 'Linux' ,
15
15
:id => 'root' ,
16
16
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
17
+ :selinux => true ,
17
18
}
18
19
end
19
20
it { is_expected . to contain_file ( '/var/lib/pgsql/data' ) . with_ensure ( 'directory' ) }
28
29
:kernel => 'Linux' ,
29
30
:id => 'root' ,
30
31
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
32
+ :selinux => true ,
31
33
}
32
34
end
33
35
it { is_expected . to contain_file ( '/var/lib/pgsql92/data' ) . with_ensure ( 'directory' ) }
43
45
:kernel => 'Linux' ,
44
46
:id => 'root' ,
45
47
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
48
+ :selinux => true ,
46
49
}
47
50
end
48
51
let ( :pre_condition ) do
@@ -71,6 +74,7 @@ class { 'postgresql::server': }
71
74
:kernel => 'Linux' ,
72
75
:id => 'root' ,
73
76
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
77
+ :selinux => true ,
74
78
}
75
79
end
76
80
let ( :pre_condition ) do
@@ -99,6 +103,7 @@ class { 'postgresql::server': }
99
103
:kernel => 'Linux' ,
100
104
:id => 'root' ,
101
105
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
106
+ :selinux => true ,
102
107
}
103
108
end
104
109
Original file line number Diff line number Diff line change 10
10
:kernel => 'Linux' ,
11
11
:id => 'root' ,
12
12
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
13
+ :selinux => true ,
13
14
}
14
15
end
15
16
Original file line number Diff line number Diff line change 10
10
:concat_basedir => tmpfilename ( 'contrib' ) ,
11
11
:id => 'root' ,
12
12
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
13
+ :selinux => true ,
13
14
}
14
15
end
15
16
39
40
:concat_basedir => tmpfilename ( 'contrib' ) ,
40
41
:id => 'root' ,
41
42
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
43
+ :selinux => true ,
42
44
}
43
45
end
44
46
let ( :params ) { { :ensure => 'present' , :name => 'port_spec' , :value => '5432' } }
58
60
:concat_basedir => tmpfilename ( 'contrib' ) ,
59
61
:id => 'root' ,
60
62
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
63
+ :selinux => true ,
61
64
}
62
65
end
63
66
let ( :params ) { { :ensure => 'present' , :name => 'port_spec' , :value => '5432' } }
77
80
:concat_basedir => tmpfilename ( 'contrib' ) ,
78
81
:id => 'root' ,
79
82
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
83
+ :selinux => true ,
80
84
}
81
85
end
82
86
let ( :params ) { { :ensure => 'present' , :name => 'port_spec' , :value => '5432' } }
You can’t perform that action at this time.
0 commit comments