8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/cfnbackup/utils.rb', line 8
def self.deep_merge(global, custom)
custom.each do |k,v|
Log.logger.debug("Checking global config for #{k}:#{v}")
if global.key? k
if global[k].class == Hash && custom[k].class == Hash
Log.logger.debug("Key #{k} is a Hash present in both templates, running merge recursively")
global[k] = deep_merge(global[k], v)
else
Log.logger.debug("Overriding defaults with key-value pair #{k}:#{v}")
global[k] = v
end
else
Log.logger.debug("Key-value pair #{k}:#{v} not found in original config, appending")
global[k] = v
end
end
return global
end
|