Merge pull request #8337 from taciomcosta/master

exit when minikube addons configure is called on a nonexistent cluster
pull/8373/head
Sharif Elgamal 2020-06-04 10:07:05 -07:00 committed by GitHub
commit c93576b5a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 6 deletions

View File

@ -23,6 +23,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/service"
)
@ -188,10 +189,7 @@ var addonsConfigureCmd = &cobra.Command{
case "metallb":
profile := ClusterFlagValue()
cfg, err := config.Load(profile)
if err != nil {
out.ErrT(out.FatalType, "Failed to load config {{.profile}}", out.V{"profile": profile})
}
_, cfg := mustload.Partial(profile)
validator := func(s string) bool {
return net.ParseIP(s) != nil
@ -205,8 +203,7 @@ var addonsConfigureCmd = &cobra.Command{
cfg.KubernetesConfig.LoadBalancerEndIP = AskForStaticValidatedValue("-- Enter Load Balancer End IP: ", validator)
}
err = config.SaveProfile(profile, cfg)
if err != nil {
if err := config.SaveProfile(profile, cfg); err != nil {
out.ErrT(out.FatalType, "Failed to save config {{.profile}}", out.V{"profile": profile})
}