getFirstMinion should return minion id
* Minion id may not be in FQDN format
* pipeline-library should not use any wildcards (*) for minion
targeting
* Unexpected minions may be filtered for result of this function
For example:
getFirstMinion returns 'ctl01'
execution of salt.getReturnValues with 'ctl01*' will also filter
'ctl0100'
Change-Id: Ia2b3460aeabc928f7cfa7d01a4dacb91e36c9e9d
Related-PROD: PROD-22709
diff --git a/src/com/mirantis/mk/Openstack.groovy b/src/com/mirantis/mk/Openstack.groovy
index fa60053..37fc73e 100644
--- a/src/com/mirantis/mk/Openstack.groovy
+++ b/src/com/mirantis/mk/Openstack.groovy
@@ -426,7 +426,7 @@
def salt = new com.mirantis.mk.Salt()
def common = new com.mirantis.mk.Common()
for (s in services) {
- def outputServicesStr = salt.getReturnValues(salt.cmdRun(env, "${probe}*", "service --status-all | grep ${s} | awk \'{print \$4}\'"))
+ def outputServicesStr = salt.getReturnValues(salt.cmdRun(env, probe, "service --status-all | grep ${s} | awk \'{print \$4}\'"))
def servicesList = outputServicesStr.tokenize("\n").init()
if (confirm) {
if (servicesList) {
@@ -434,7 +434,7 @@
input message: "Click PROCEED to stop ${servicesList}. Otherwise click ABORT to skip stopping them."
for (name in servicesList) {
if (!name.contains('Salt command')) {
- salt.runSaltProcessStep(env, "${target}*", 'service.stop', ["${name}"])
+ salt.runSaltProcessStep(env, target, 'service.stop', ["${name}"])
}
}
} catch (Exception er) {
@@ -445,7 +445,7 @@
if (servicesList) {
for (name in servicesList) {
if (!name.contains('Salt command')) {
- salt.runSaltProcessStep(env, "${target}*", 'service.stop', ["${name}"])
+ salt.runSaltProcessStep(env, target, 'service.stop', ["${name}"])
}
}
}
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index eb7b168..e2f4189 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -599,7 +599,7 @@
*/
def getFirstMinion(saltId, target) {
def minionsSorted = getMinionsSorted(saltId, target)
- return minionsSorted[0].split("\\.")[0]
+ return minionsSorted[0]
}
/**