mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
use FindFiles for postgres conf
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
This commit is contained in:
parent
c733a577da
commit
93065b9dda
2 changed files with 7 additions and 5 deletions
|
@ -63,7 +63,7 @@ class ApacheConf
|
||||||
required = Array.new
|
required = Array.new
|
||||||
include_files.each do |f|
|
include_files.each do |f|
|
||||||
id = File.join(@conf_dir, f)
|
id = File.join(@conf_dir, f)
|
||||||
required.push(FindFiles.find(id))
|
required.push(FindFiles.find(id, depth: 1, type: 'file'))
|
||||||
end
|
end
|
||||||
|
|
||||||
required.flatten!
|
required.flatten!
|
||||||
|
@ -74,7 +74,7 @@ class ApacheConf
|
||||||
optional = Array.new
|
optional = Array.new
|
||||||
include_files_optional.each do |f|
|
include_files_optional.each do |f|
|
||||||
id = File.join(@conf_dir, f)
|
id = File.join(@conf_dir, f)
|
||||||
optional.push(FindFiles.find(id))
|
optional.push(FindFiles.find(id, depth: 1, type: 'file'))
|
||||||
end
|
end
|
||||||
|
|
||||||
optional.flatten!
|
optional.flatten!
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# license: All rights reserved
|
# license: All rights reserved
|
||||||
|
|
||||||
require 'utils/simpleconfig'
|
require 'utils/simpleconfig'
|
||||||
|
require 'utils/find_files'
|
||||||
require 'resources/postgres'
|
require 'resources/postgres'
|
||||||
|
|
||||||
class PostgresConf
|
class PostgresConf
|
||||||
|
@ -45,9 +46,10 @@ class PostgresConf
|
||||||
# see if there is more config files to include
|
# see if there is more config files to include
|
||||||
include_files = params['include'] || []
|
include_files = params['include'] || []
|
||||||
include_files += params['include_if_exists'] || []
|
include_files += params['include_if_exists'] || []
|
||||||
(params['include_dir'] || []).each do |id|
|
dirs = params['include_dir'] || []
|
||||||
id = File.join(@conf_dir, id) if id[0] != '/'
|
dirs.each do |dir|
|
||||||
include_files += Dir.glob(File.join id, '*')
|
dir = File.join(@conf_dir, dir) if dir[0] != '/'
|
||||||
|
include_files += FindFiles.find(dir, depth: 1, type: 'file')
|
||||||
end
|
end
|
||||||
to_read += include_files.find_all do |fp|
|
to_read += include_files.find_all do |fp|
|
||||||
not @files_contents.key? fp
|
not @files_contents.key? fp
|
||||||
|
|
Loading…
Reference in a new issue