throw expection when update-package do not target any minion
Change-Id: Id9d9b74fefeaad82a3d22d44ade46c6135a049e7
diff --git a/update-package.groovy b/update-package.groovy
index b37fe22..73db088 100644
--- a/update-package.groovy
+++ b/update-package.groovy
@@ -35,13 +35,18 @@
stage('List target servers') {
minions = salt.getMinions(saltMaster, targetAll)
+
+ if (minions.isEmpty()) {
+ throw new Exception("No minion was targeted")
+ }
+
if (TARGET_SUBSET_TEST != "") {
targetTestSubset = minions.subList(0, Integer.valueOf(TARGET_SUBSET_TEST)).join(' or ')
- }
- else {
+ } else {
targetTestSubset = minions.join(' or ')
}
targetLiveSubset = minions.subList(0, Integer.valueOf(TARGET_SUBSET_LIVE)).join(' or ')
+
targetLiveAll = minions.join(' or ')
common.infoMsg("Found nodes: ${targetLiveAll}")
common.infoMsg("Selected test nodes: ${targetTestSubset}")