-
Notifications
You must be signed in to change notification settings - Fork 23
adjust the service for each os type and correct the control 10 #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,10 +66,37 @@ | |
impact 1.0 | ||
title 'Postgresql should be running' | ||
desc 'Postgresql should be running.' | ||
describe service(postgres.service) do | ||
it { should be_installed } | ||
it { should be_running } | ||
it { should be_enabled } | ||
case os[:name] | ||
when 'ubuntu' | ||
case os[:release] | ||
when '12.04' | ||
describe service(postgres.service) do | ||
it { should be_installed } | ||
it { should be_running } | ||
it { should be_enabled } | ||
end | ||
when '16.04' | ||
describe systemd_service(postgres.service) do | ||
it { should be_installed } | ||
it { should be_running } | ||
it { should be_enabled } | ||
end | ||
end | ||
when 'redhat', 'centos', 'oracle' | ||
case os[:release] | ||
when /6\./ | ||
describe runit_service(postgres.service) do | ||
it { should be_installed } | ||
it { should be_running } | ||
it { should be_enabled } | ||
end | ||
when /7\./ | ||
describe systemd_service(postgres.service) do | ||
it { should be_installed } | ||
it { should be_running } | ||
it { should be_enabled } | ||
end | ||
end | ||
end | ||
end | ||
|
||
|
@@ -91,8 +118,14 @@ | |
impact 1.0 | ||
title 'Run one postgresql instance per operating system' | ||
desc 'Only one postgresql database instance must be running on an operating system instance (both physical HW or virtualized).' | ||
describe command('ps aux | grep \'postgres -D\' | grep -v grep | wc -l') do | ||
its('stdout') { should match(/^1/) } | ||
if os[:family] == 'debian' | ||
describe processes('postgres') do | ||
its('list.length') { should eq 1 } | ||
end | ||
elsif os[:family] == 'redhat' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use |
||
describe processes('postmaster') do | ||
its('list.length') { should eq 1 } | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the input. i will do the changes |
||
end | ||
end | ||
|
||
|
@@ -162,14 +195,14 @@ | |
it { should be_directory } | ||
it { should be_owned_by USER } | ||
it { should be_readable.by('owner') } | ||
it { should be_readable.by('group') } | ||
it { should be_readable.by('other') } | ||
it { should_not be_readable.by('group') } | ||
it { should_not be_readable.by('other') } | ||
it { should be_writable.by('owner') } | ||
it { should_not be_writable.by('group') } | ||
it { should_not be_writable.by('other') } | ||
it { should be_executable.by('owner') } | ||
it { should be_executable.by('group') } | ||
it { should be_executable.by('other') } | ||
it { should_not be_executable.by('group') } | ||
it { should_not be_executable.by('other') } | ||
end | ||
describe file(POSTGRES_CONF_PATH) do | ||
it { should be_file } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be related to inspec/inspec#931, similar things are reported to happen with debian