timeout added
Change-Id: I5d47f697b0cc2791441f95d2661e888b117e70f7
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 75349a4..1292d65 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -53,9 +53,10 @@
* @param batch Batch param to salt (integer or string with percents)
* @param args Additional arguments to function
* @param kwargs Additional key-value arguments to function
+ * @param timeout Additional argument salt api timeout
*/
@NonCPS
-def runSaltCommand(master, client, target, function, batch = null, args = null, kwargs = null) {
+def runSaltCommand(master, client, target, function, batch = null, args = null, kwargs = null, timeout = -1) {
def http = new com.mirantis.mk.Http()
data = [
@@ -78,6 +79,10 @@
data['kwarg'] = kwargs
}
+ if (timeout != -1) {
+ data['timeout'] = timeout
+ }
+
headers = [
'X-Auth-Token': "${master.authToken}"
]
@@ -263,22 +268,24 @@
* @param arg process step arguments (optional, default [])
* @param batch salt batch parameter integer or string with percents (optional, default null - disable batch)
* @param output print output (optional, default false)
+ * @param timeout Additional argument salt api timeout
* @return output of salt command
*/
-def runSaltProcessStep(master, tgt, fun, arg = [], batch = null, output = false) {
+def runSaltProcessStep(master, tgt, fun, arg = [], batch = null, output = false, timeout = -1) {
def common = new com.mirantis.mk.Common()
+ def salt = new com.mirantis.mk.Salt()
def out
common.infoMsg("Running step ${fun} on ${tgt}")
if (batch == true) {
- out = runSaltCommand(master, 'local_batch', ['expression': tgt, 'type': 'compound'], fun, String.valueOf(batch), arg)
+ out = runSaltCommand(master, 'local_batch', ['expression': tgt, 'type': 'compound'], fun, String.valueOf(batch), arg, null, timeout)
} else {
- out = runSaltCommand(master, 'local', ['expression': tgt, 'type': 'compound'], fun, batch, arg)
+ out = runSaltCommand(master, 'local', ['expression': tgt, 'type': 'compound'], fun, batch, arg, null, timeout)
}
if (output == true) {
- printSaltCommandResult(out)
+ salt.printSaltCommandResult(out)
}
return out
}