From bfd74b9edf45c55715ef9aca326ac2399e267c87 Mon Sep 17 00:00:00 2001 From: Mahdi Fooladgar Date: Fri, 8 Dec 2023 12:23:55 +0330 Subject: [PATCH 1/3] Fix #17: Checking postgresql status on Ubuntu Signed-off-by: Mahdi Fooladgar --- controls/postgres_spec.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/controls/postgres_spec.rb b/controls/postgres_spec.rb index dc40f56..0fb93ee 100644 --- a/controls/postgres_spec.rb +++ b/controls/postgres_spec.rb @@ -38,10 +38,16 @@ 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 } + if os[:name] == "ubuntu" + describe command('/etc/init.d/postgresql status') do + its('stdout') { should include 'active' } + end + else + describe service(postgres.service) do + it { should be_installed } + it { should be_running } + it { should be_enabled } + end end end From b402ef615f30eb4a4fc1d2bbadf1c7e187f20f54 Mon Sep 17 00:00:00 2001 From: Mahdi Fooladgar Date: Fri, 8 Dec 2023 12:37:30 +0330 Subject: [PATCH 2/3] Fix a typo on using double-quoted strings Signed-off-by: Mahdi Fooladgar --- controls/postgres_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controls/postgres_spec.rb b/controls/postgres_spec.rb index 0fb93ee..7a8ef10 100644 --- a/controls/postgres_spec.rb +++ b/controls/postgres_spec.rb @@ -38,7 +38,7 @@ impact 1.0 title 'Postgresql should be running' desc 'Postgresql should be running.' - if os[:name] == "ubuntu" + if os[:name] == 'ubuntu' describe command('/etc/init.d/postgresql status') do its('stdout') { should include 'active' } end From 17eb756e6c0838d84d974cd32fb599d875582543 Mon Sep 17 00:00:00 2001 From: Mahdi Fooladgar Date: Fri, 8 Dec 2023 19:05:36 +0330 Subject: [PATCH 3/3] Remove postgre-01 Signed-off-by: Mahdi Fooladgar --- controls/postgres_spec.rb | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/controls/postgres_spec.rb b/controls/postgres_spec.rb index 7a8ef10..35d354f 100644 --- a/controls/postgres_spec.rb +++ b/controls/postgres_spec.rb @@ -34,23 +34,6 @@ command('psql').exist? end -control 'postgres-01' do - impact 1.0 - title 'Postgresql should be running' - desc 'Postgresql should be running.' - if os[:name] == 'ubuntu' - describe command('/etc/init.d/postgresql status') do - its('stdout') { should include 'active' } - end - else - describe service(postgres.service) do - it { should be_installed } - it { should be_running } - it { should be_enabled } - end - end -end - control 'postgres-02' do impact 1.0 title 'Use stable postgresql version'