Use common waitForHealthy function from pipeline-library
Additional improvements:
* small refactoring of common functions
* add check for prometheus nodes before running
prometheus state
* improve usage of waitForHealthy function with flags
PROD-33010
Change-Id: Ic8679fb0178965c9788c12793902c9bc265a6146
diff --git a/ceph-add-node.groovy b/ceph-add-node.groovy
index 33a5a67..9ec96c2 100644
--- a/ceph-add-node.groovy
+++ b/ceph-add-node.groovy
@@ -75,14 +75,18 @@
}
stage("Update/Install monitoring") {
- //Collect Grains
- salt.enforceState(pepperEnv, HOST, 'salt.minion.grains')
- salt.runSaltProcessStep(pepperEnv, HOST, 'saltutil.refresh_modules')
- salt.runSaltProcessStep(pepperEnv, HOST, 'mine.update')
- sleep(5)
-
- salt.enforceState(pepperEnv, HOST, 'prometheus')
- salt.enforceState(pepperEnv, 'I@prometheus:server', 'prometheus')
+ def prometheusNodes = salt.getMinions(pepperEnv, 'I@prometheus:server')
+ if (!prometheusNodes.isEmpty()) {
+ //Collect Grains
+ salt.enforceState(pepperEnv, HOST, 'salt.minion.grains')
+ salt.runSaltProcessStep(pepperEnv, HOST, 'saltutil.refresh_modules')
+ salt.runSaltProcessStep(pepperEnv, HOST, 'mine.update')
+ sleep(5)
+ salt.enforceState(pepperEnv, HOST, 'prometheus')
+ salt.enforceState(pepperEnv, 'I@prometheus:server', 'prometheus')
+ } else {
+ common.infoMsg('No Prometheus nodes in cluster. Nothing to do')
+ }
}
}
}