File tree 6 files changed +73
-8
lines changed
6 files changed +73
-8
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- # Overide by Platform
4
3
service_name = 'postgresql'
5
- pg_port = 5432
6
- if ( platform [ :name ] == 'centos' ) && platform [ :release ] . start_with? ( '6' )
7
- service_name = 'postgresql-9.6'
8
- elsif ( platform [ :family ] == 'debian' ) || ( platform [ :family ] == 'suse' )
9
- pg_port = 5433
10
- end
4
+
5
+ pg_port =
6
+ case platform [ :family ]
7
+ when 'debian' , 'suse'
8
+ 5433
9
+ else
10
+ 5432
11
+ end
11
12
12
13
control 'Postgres service' do
13
14
impact 0.5
14
- title 'should be running and enabled '
15
+ title 'should be installed, enabled and running '
15
16
16
17
describe service ( service_name ) do
18
+ it { should be_installed }
17
19
it { should be_enabled }
18
20
it { should be_running }
19
21
end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ # https://docs.chef.io/inspec/profiles/#including-all-controls-from-a-profile
4
+ # Could use `include_controls` in this scenario
5
+ # include_controls 'share'
6
+
7
+ # https://docs.chef.io/inspec/profiles/#selectively-including-controls-from-a-profile
8
+ # However, using `require_controls` for more clarity
9
+ require_controls 'share' do
10
+ control 'Postgres command'
11
+ control 'Postgres configuration'
12
+ # control 'Postgres service'
13
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ service_name =
4
+ case platform [ :family ]
5
+ when 'redhat' , 'fedora' , 'suse'
6
+ case system . platform [ :release ]
7
+ when 'tumbleweed'
8
+ 'postgresql'
9
+ else
10
+ 'postgresql-13'
11
+ end
12
+ else
13
+ 'postgresql'
14
+ end
15
+
16
+ pg_port =
17
+ case platform [ :family ]
18
+ when 'debian' , 'suse'
19
+ 5433
20
+ else
21
+ 5432
22
+ end
23
+
24
+ control 'Postgres service' do
25
+ impact 0.5
26
+ title 'should be installed, enabled and running'
27
+
28
+ describe service ( service_name ) do
29
+ it { should be_installed }
30
+ it { should be_enabled }
31
+ it { should be_running }
32
+ end
33
+
34
+ describe port ( pg_port ) do
35
+ it { should be_listening }
36
+ end
37
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ # https://docs.chef.io/inspec/profiles/#including-all-controls-from-a-profile
4
+ # Could use `include_controls` in this scenario
5
+ # include_controls 'share'
6
+
7
+ # https://docs.chef.io/inspec/profiles/#selectively-including-controls-from-a-profile
8
+ # However, using `require_controls` for more clarity
9
+ require_controls 'share' do
10
+ control 'Postgres command'
11
+ control 'Postgres configuration'
12
+ # control 'Postgres service'
13
+ end
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments