stx-init-env: faster minikube status check

Avoid "minikube profile list" when checking whether the profile exists.
The list command attempts to connect to each profile and is quite slow.

Use "minikube status -p $MINIKUBENAME" instead.

Story: 2011038
Task: 49570

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: If799840d749de00af907de7867ec68fb9908afa3
This commit is contained in:
Davlet Panech 2024-02-14 09:57:57 -05:00
parent 4187e73f86
commit 4df5160bbd

View File

@ -185,16 +185,9 @@ starts_with() {
}
minikube_profile_is_started() {
local result
result=$(
minikube profile list \
| tr -d '|' \
| awk -v profile="$MINIKUBENAME" '{ if ($1 == profile && $7 == "Running") print $1 }'
)
[[ -n "$result" ]]
minikube status -p "$MINIKUBENAME" >/dev/null 2>&1
}
minikube_profile_exists() {
local script=$(cat <<'END'
import json,sys