Add common function for getting Salt worker_threads value

Change-Id: I1ba149194d939cf6d962bc0322e9f6d6190225ae
Related-Prod: PROD-27850
(cherry picked from commit 3621b96c3b09cef38964faf5ed6ec84020ff9fb9)
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index c31e6a8..407e457 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -1392,3 +1392,18 @@
         return false
     }
 }
+
+/**
+* Returns nubmer of worker_threads set for Salt Master
+*
+* @param saltId  Salt Connection object or pepperEnv
+*
+*/
+def getWorkerThreads(saltId) {
+    if (env.getEnvironment().containsKey('SALT_MASTER_OPT_WORKER_THREADS')) {
+        return env['SALT_MASTER_OPT_WORKER_THREADS'].toString()
+    }
+    def threads = cmdRun(saltId, "I@salt:master", "cat /etc/salt/master.d/master.conf | grep worker_threads | cut -f 2 -d ':'", true, null, true)
+    return threads['return'][0].values()[0].replaceAll('Salt command execution success','').trim()
+}
+