Add correct salt minions update
osUpgradeNode is not aware of how to update salt minions, thus is failing
when salt master looses the connection to minions. This patch add the proper
procedure to update salt minions before other packages will be updated.
Closes-Bug: PROD-35355
Change-Id: I185a121999f4a49c8b5a2a126cca0f3710149118
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 30957e5..2c58e9a 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -332,9 +332,10 @@
* @param output do you want to print output
* @param saltArgs additional salt args eq. ["runas=aptly"]
* @param replacing list with maps for deletion in info message (passwords, logins, etc)
+ * @param async run commands with async client (default false)
* @return output of salt command
*/
-def cmdRun(saltId, target, cmd, checkResponse = true, batch=null, output = true, saltArgs = [], replacing = []) {
+def cmdRun(saltId, target, cmd, checkResponse = true, batch=null, output = true, saltArgs = [], replacing = [], async = false) {
def common = new com.mirantis.mk.Common()
def originalCmd = cmd
common.infoSensitivityMsg("Running command ${cmd} on ${target}", true, replacing)
@@ -345,7 +346,8 @@
// add cmd name to salt args list
saltArgs << cmd
- def out = runSaltCommand(saltId, 'local', ['expression': target, 'type': 'compound'], 'cmd.run', batch, saltArgs.reverse())
+ def client = async ? 'local_async' : 'local'
+ def out = runSaltCommand(saltId, client, ['expression': target, 'type': 'compound'], 'cmd.run', batch, saltArgs.reverse())
if (checkResponse) {
// iterate over all affected nodes and check success return code
if (out["return"]){