Skip to content

Commit

Permalink
MPL-1 mergeMaps will process every value in overlay (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
sparshev authored and pazovtsev committed Jun 22, 2018
1 parent b2f5550 commit ddf014b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/com/griddynamics/devops/mpl/Helper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ abstract class Helper {
* @return modified base map
*/
static Map mergeMaps(Map base, Map overlay) {
if( ! overlay ) return base
if( ! (base in Map) ) base = [:]
if( ! (overlay in Map) ) return overlay
overlay.each { key, val ->
base[key] = base[key] in Map ? mergeMaps(base[key], val) : val
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/griddynamics/devops/mpl/MPLManager.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class MPLManager implements Serializable {
* @return Overriden configuration for the specified module
*/
public Map moduleConfig(String name) {
config.modules ? Helper.mergeMaps(config.subMap(config.keySet()-'modules'), config.modules[name]) : [:]
config.modules ? Helper.mergeMaps(config.subMap(config.keySet()-'modules'), (config.modules[name] ?: [:])) : [:]
}

/**
Expand Down

0 comments on commit ddf014b

Please sign in to comment.