Skip to content

Commit 8b5c979

Browse files
committed
guard against cases where paths are nil
1 parent a77f429 commit 8b5c979

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

controls/postgres_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
POSTGRES_HBA_CONF_FILE = attribute(
5656
'postgres_hba_conf_file',
5757
description: 'define path for the postgresql configuration file',
58-
default: postgres.conf_dir + '/pg_hba.conf'
58+
default: File.join(postgres.conf_dir.to_s, 'pg_hba.conf')
5959
)
6060

6161
only_if do
@@ -187,7 +187,7 @@
187187
impact 1.0
188188
title 'The PostgreSQL "data_directory" should be assigned exclusively to the database account (such as "postgres").'
189189
desc 'If file permissions on data are not property defined, other users may read, modify or delete those files.'
190-
find_command = 'find ' + POSTGRES_DATA + ' -user ' + USER + ' -group ' + USER + ' -perm /go=rwx'
190+
find_command = 'find ' + POSTGRES_DATA.to_s + ' -user ' + USER + ' -group ' + USER + ' -perm /go=rwx'
191191
describe command(find_command) do
192192
its('stdout') { should eq '' }
193193
end
@@ -274,7 +274,7 @@
274274
impact 1.0
275275
title 'We accept one peer and one ident for now (chef automation)'
276276
desc 'We accept one peer and one ident for now (chef automation)'
277-
describe command('cat ' + POSTGRES_HBA_CONF_FILE + ' | egrep \'peer|ident\' | wc -l') do
277+
describe command('cat ' + POSTGRES_HBA_CONF_FILE.to_s + ' | egrep \'peer|ident\' | wc -l') do
278278
its('stdout') { should match(/^[2|1]/) }
279279
end
280280
end

0 commit comments

Comments
 (0)