Add new function setSaltOverrides
Change-Id: I54ef1ff6ccfeac68ed4514819f926899d191cedb
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 1292d65..31158b2 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -429,3 +429,23 @@
result = cmdRun(master, target, "cat ${file}")
return result['return'][0].values()[0]
}
+
+/**
+ * Set override parameters in Salt cluster metadata
+ *
+ * @param master Salt master object
+ * @param salt_overrides YAML formatted string containing key: value, one per line
+ */
+
+def setSaltOverrides(master, salt_overrides, debug=false) {
+ def mcpcommon = new com.mirantis.mcp.Common()
+
+ def salt_overrides_map = mcpcommon.loadYAML(salt_overrides)
+ for (entry in common.entries(SALT_OVERRIDES_MAP)) {
+ def key = entry[0]
+ def value = entry[1]
+
+ common.debugMsg("Set salt override ${key}=${value}")
+ runSaltProcessStep(master, 'I@salt:master', 'reclass.cluster_meta_set', ["${key}", "${value}"], false, debug)
+ }
+}