9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/inventory/server/config.rb', line 9
def self.generate(cli_config)
mapping = {
'stdout'=> $stdout,
'stderr'=> $stderr,
'INFO'=>Logger::INFO,
'DEBUG'=>Logger::DEBUG,
'WARN'=>Logger::WARN,
'ERROR'=>Logger::ERROR,
'FATAL'=>Logger::FATAL
}
config = self.defaults.merge self.etc.merge self.env.merge cli_config
config.each{|sym, val|
next unless val
config[sym] = mapping[val] if mapping[val]
if val.is_a? String and [:plugins, :plugins_path].include? sym
config[sym] = val.split(',').collect(&:strip)
end
}
FileUtils.mkdir_p config[:failed_facts_dir]
return config
end
|