[bitnami/kibana] Fix is_kibana_running function (#3479)

* Fix is_kibana_running function

Signed-off-by: Anthony Day <aday@cyral.com>

* Update status check to cover Kibana 7 & 8

Signed-off-by: Anthony Day <aday@cyral.com>

* Simplify logic

Signed-off-by: Anthony Day <aday@cyral.com>

Signed-off-by: Anthony Day <aday@cyral.com>
This commit is contained in:
Anthony 2022-09-13 21:26:45 +10:00 committed by GitHub
parent 80ea88bc99
commit 327928dc57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -310,8 +310,9 @@ is_kibana_ready() {
# Therefore, we must check the value is not 'true'
[[ ! "$rewriteBasePath" = "false" ]] && basePath=$(kibana_conf_get "server.basePath")
if is_kibana_running; then
local -r state="$(yq eval ".status.overall.state" - <<<"$(curl -s "127.0.0.1:${KIBANA_PORT_NUMBER}${basePath:-}/api/status")")"
[[ "$state" = "green" ]]
# Kibana 7 expects .status.overall.state to be 'green', while 8 expects .status.overall.level to be 'available'
local -r status="$(yq eval '.status.overall | pick(["state", "level"]) | .[]' - <<<"$(curl -s "127.0.0.1:${KIBANA_PORT_NUMBER}${basePath:-}/api/status")")"
[[ "$status" = "green" || "$status" = "available" ]] && return
else
false
fi

View File

@ -310,8 +310,9 @@ is_kibana_ready() {
# Therefore, we must check the value is not 'true'
[[ ! "$rewriteBasePath" = "false" ]] && basePath=$(kibana_conf_get "server.basePath")
if is_kibana_running; then
local -r state="$(yq eval ".status.overall.state" - <<<"$(curl -s "127.0.0.1:${KIBANA_PORT_NUMBER}${basePath:-}/api/status")")"
[[ "$state" = "green" ]]
# Kibana 7 expects .status.overall.state to be 'green', while 8 expects .status.overall.level to be 'available'
local -r status="$(yq eval '.status.overall | pick(["state", "level"]) | .[]' - <<<"$(curl -s "127.0.0.1:${KIBANA_PORT_NUMBER}${basePath:-}/api/status")")"
[[ "$status" = "green" || "$status" = "available" ]] && return
else
false
fi