Debian: stx-init-env: fix --nuke option KeyError exception
Add the checking for minikube_exists to avoid the KeyError error, when the command './stx-init-env --nuke' is executed and the minikube cluster doesn't exist. Story: 2009897 Task: 45824 Test Plan: Pass: export MINIKUBENAME=abc ...... './stx-init-env --nuke' works without the KeyError exception. Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com> Change-Id: I2cf46e01df312604ca2a0afa38a498e7397747b8
This commit is contained in:
parent
2fc0fb338f
commit
1211204a42
@ -61,6 +61,8 @@ minikube_exists() {
|
||||
local script=$(cat <<'END'
|
||||
import json,sys
|
||||
data = json.load (sys.stdin)
|
||||
if 'valid' not in data or 'invalid' not in data:
|
||||
sys.exit(1)
|
||||
for x in data['valid']+data['invalid']:
|
||||
if x['Name'] == sys.argv[1]:
|
||||
sys.exit(0)
|
||||
@ -218,6 +220,10 @@ if [ "$STX_PLATFORM" = "minikube" ]; then
|
||||
if minikube_exists ; then
|
||||
notice "Deleting minikube cluster \`$MINIKUBENAME'"
|
||||
$MINIKUBE delete -p "$MINIKUBENAME" || exit 1
|
||||
else
|
||||
notice "Please check your minikube cluster MINIKUBENAME: \`$MINIKUBENAME'."
|
||||
notice "It doesn't exist or it existed but not for your MINIKUBE_HOME: \`$MINIKUBE_HOME'."
|
||||
notice "Please re-export the correct project variable pairs!!!"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user