From a01e6dd569559b193a24092aaf9d4bd6986311a1 Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Sat, 15 Jun 2019 23:10:06 -0700 Subject: [PATCH] notify user of skipping --- cmd/minikube/cmd/config/profile.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/minikube/cmd/config/profile.go b/cmd/minikube/cmd/config/profile.go index 4b61b77c9..9dd9b4e6e 100644 --- a/cmd/minikube/cmd/config/profile.go +++ b/cmd/minikube/cmd/config/profile.go @@ -56,12 +56,15 @@ var ProfileCmd = &cobra.Command{ if err != nil && !os.IsNotExist(err) { console.ErrLn("Error loading profile config: %v", err) } - // don't change context is user has started the minikube with --keep-context - if !cc.MachineConfig.KeepContext { - err = pkgutil.SetCurrentContext(constants.KubeconfigPath, profile) - console.ErrLn("error while setting kubectl current context : %v", err) + if cc.MachineConfig.KeepContext { + console.Success("Skipped switching kubectl context for %s , because --keep-context", profile) + console.Success("To connect to this cluster, use: kubectl --context=%s", profile) + } else { + err := pkgutil.SetCurrentContext(constants.KubeconfigPath, profile) + if err != nil { + console.ErrLn("error while setting kubectl current context : %v", err) + } } - console.Success("minikube profile was successfully set to %s", profile) }, } -- GitLab