16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/depengine/provider/cdb_filesystem.rb', line 16
def read_data(cdb_path, options = {})
config = {}
basedir = File.join(($recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]), 'cdb')
filename = ''
if cdb_path.nil? or cdb_path.empty?
$log.writer.error 'Error while talking to configuration database, no cdb path given!'
exit 1
end
paths = cdb_path.split('/')
paths.each do |path|
basedir = File.join(basedir, path.to_s)
filename = basedir + '.yaml'
additional_config = load_yaml(filename)
next unless additional_config.is_a?(Hash)
if options[:disable_merge]
config = additional_config
else
config.merge!(additional_config)
end
end
config.to_json
end
|