Fix getting pillar values for ES health check
Change-Id: I36dba770b148aa532b0ec6eb0063c95df5b07e41
PROD-related: PROD-30582
diff --git a/stacklight-upgrade.groovy b/stacklight-upgrade.groovy
index a2d09e1..7f55c5d 100644
--- a/stacklight-upgrade.groovy
+++ b/stacklight-upgrade.groovy
@@ -51,28 +51,32 @@
try {
def retries_wait = 20
def retries = 15
+
def elasticsearch_vip
- def pillar = salt.getPillar(master, "I@elasticsearch:client", 'elasticsearch:client:server:host')
- if(!pillar['return'].isEmpty()) {
- elasticsearch_vip = pillar['return'][0].values()[0]
+ def pillar = salt.getReturnValues(salt.getPillar(master, "I@elasticsearch:client", 'elasticsearch:client:server:host'))
+ if(!pillar.isEmpty()) {
+ elasticsearch_vip = pillar
} else {
errorOccured = true
common.errorMsg('[ERROR] Elasticsearch VIP address could not be retrieved')
}
- pillar = salt.getPillar(master, "I@elasticsearch:client", 'elasticsearch:client:server:port')
+
+ pillar = salt.getReturnValues(salt.getPillar(master, "I@elasticsearch:client", 'elasticsearch:client:server:port'))
def elasticsearch_port
- if(!pillar['return'].isEmpty()) {
- elasticsearch_port = pillar['return'][0].values()[0]
+ if(!pillar.isEmpty()) {
+ elasticsearch_port = pillar
} else {
errorOccured = true
common.errorMsg('[ERROR] Elasticsearch VIP port could not be retrieved')
}
- pillar = salt.getPillar(master, "I@elasticsearch:client ${extra_tgt}", 'elasticsearch:client:server:scheme')
+
+ pillar = salt.getReturnValues(salt.getPillar(master, "I@elasticsearch:client ${extra_tgt}", 'elasticsearch:client:server:scheme'))
def elasticsearch_scheme
- if(!pillar['return'].isEmpty()) {
- elasticsearch_scheme = pillar['return'][0].values()[0]
+ if(!pillar.isEmpty()) {
+ elasticsearch_scheme = pillar
+ common.infoMsg("[INFO] Using elasticsearch scheme: ${elasticsearch_scheme}")
} else {
- common.infoMsg('No pillar with Elasticsearch server scheme, using http')
+ common.infoMsg('[INFO] No pillar with Elasticsearch server scheme, using scheme: http')
elasticsearch_scheme = "http"
}