Add ability to manage extra repo config with different way
Add ability to manage extra repo config with:
- merge strategy, when passed extra repo config will be deeply merged
with default extra repo config;
- override strategy, when passed extra repo config will be used
instead of default extra repo config;
Also add function for merging nested maps.
Change-Id: I4b672e9dd984fc82c4a5a0e1a86e93d7b1099dba
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index 1f96449..09f1b51 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -919,9 +919,9 @@
/**
* Ugly processing basic funcs with /etc/apt
- * @param configYaml
+ * @param repoConfig YAML text or Map
* Example :
- configYaml = '''
+ repoConfig = '''
---
aprConfD: |-
APT::Get::AllowUnauthenticated 'true';
@@ -940,8 +940,13 @@
*
*/
-def debianExtraRepos(configYaml) {
- def config = readYaml text: configYaml
+def debianExtraRepos(repoConfig) {
+ def config = null
+ if (repoConfig instanceof Map) {
+ config = repoConfig
+ } else {
+ config = readYaml text: repoConfig
+ }
if (config.get('repo', false)) {
for (String repo in config['repo'].keySet()) {
source = config['repo'][repo]['source']