use FindFiles for postgres conf

Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
This commit is contained in:
Dominik Richter 2015-08-02 20:17:07 -07:00
parent c733a577da
commit 93065b9dda
2 changed files with 7 additions and 5 deletions

View file

@ -63,7 +63,7 @@ class ApacheConf
required = Array.new
include_files.each do |f|
id = File.join(@conf_dir, f)
required.push(FindFiles.find(id))
required.push(FindFiles.find(id, depth: 1, type: 'file'))
end
required.flatten!
@ -74,7 +74,7 @@ class ApacheConf
optional = Array.new
include_files_optional.each do |f|
id = File.join(@conf_dir, f)
optional.push(FindFiles.find(id))
optional.push(FindFiles.find(id, depth: 1, type: 'file'))
end
optional.flatten!

View file

@ -3,6 +3,7 @@
# license: All rights reserved
require 'utils/simpleconfig'
require 'utils/find_files'
require 'resources/postgres'
class PostgresConf
@ -45,9 +46,10 @@ class PostgresConf
# see if there is more config files to include
include_files = params['include'] || []
include_files += params['include_if_exists'] || []
(params['include_dir'] || []).each do |id|
id = File.join(@conf_dir, id) if id[0] != '/'
include_files += Dir.glob(File.join id, '*')
dirs = params['include_dir'] || []
dirs.each do |dir|
dir = File.join(@conf_dir, dir) if dir[0] != '/'
include_files += FindFiles.find(dir, depth: 1, type: 'file')
end
to_read += include_files.find_all do |fp|
not @files_contents.key? fp