|
66 | 66 | impact 1.0
|
67 | 67 | title 'Postgresql should be running'
|
68 | 68 | desc 'Postgresql should be running.'
|
69 |
| - describe service(postgres.service) do |
70 |
| - it { should be_installed } |
71 |
| - it { should be_running } |
72 |
| - it { should be_enabled } |
| 69 | + case os[:name] |
| 70 | + when 'ubuntu' |
| 71 | + case os[:release] |
| 72 | + when '12.04' |
| 73 | + describe service(postgres.service) do |
| 74 | + it { should be_installed } |
| 75 | + it { should be_running } |
| 76 | + it { should be_enabled } |
| 77 | + end |
| 78 | + when '16.04' |
| 79 | + describe systemd_service(postgres.service) do |
| 80 | + it { should be_installed } |
| 81 | + it { should be_running } |
| 82 | + it { should be_enabled } |
| 83 | + end |
| 84 | + end |
| 85 | + when 'redhat', 'centos', 'oracle' |
| 86 | + case os[:release] |
| 87 | + when /6\./ |
| 88 | + describe runit_service(postgres.service) do |
| 89 | + it { should be_installed } |
| 90 | + it { should be_running } |
| 91 | + it { should be_enabled } |
| 92 | + end |
| 93 | + when /7\./ |
| 94 | + describe systemd_service(postgres.service) do |
| 95 | + it { should be_installed } |
| 96 | + it { should be_running } |
| 97 | + it { should be_enabled } |
| 98 | + end |
| 99 | + end |
73 | 100 | end
|
74 | 101 | end
|
75 | 102 |
|
|
91 | 118 | impact 1.0
|
92 | 119 | title 'Run one postgresql instance per operating system'
|
93 | 120 | desc 'Only one postgresql database instance must be running on an operating system instance (both physical HW or virtualized).'
|
94 |
| - describe command('ps aux | grep \'postgres -D\' | grep -v grep | wc -l') do |
95 |
| - its('stdout') { should match(/^1/) } |
| 121 | + if os[:family] == 'debian' |
| 122 | + describe processes('postgres') do |
| 123 | + its('list.length') { should eq 1 } |
| 124 | + end |
| 125 | + elsif os[:family] == 'redhat' |
| 126 | + describe processes('postmaster') do |
| 127 | + its('list.length') { should eq 1 } |
| 128 | + end |
96 | 129 | end
|
97 | 130 | end
|
98 | 131 |
|
|
162 | 195 | it { should be_directory }
|
163 | 196 | it { should be_owned_by USER }
|
164 | 197 | it { should be_readable.by('owner') }
|
165 |
| - it { should be_readable.by('group') } |
166 |
| - it { should be_readable.by('other') } |
| 198 | + it { should_not be_readable.by('group') } |
| 199 | + it { should_not be_readable.by('other') } |
167 | 200 | it { should be_writable.by('owner') }
|
168 | 201 | it { should_not be_writable.by('group') }
|
169 | 202 | it { should_not be_writable.by('other') }
|
170 | 203 | it { should be_executable.by('owner') }
|
171 |
| - it { should be_executable.by('group') } |
172 |
| - it { should be_executable.by('other') } |
| 204 | + it { should_not be_executable.by('group') } |
| 205 | + it { should_not be_executable.by('other') } |
173 | 206 | end
|
174 | 207 | describe file(POSTGRES_CONF_PATH) do
|
175 | 208 | it { should be_file }
|
|
0 commit comments