Merge pull request #4455 from djmgit/sudo_message
Provide warning message for unnecessary sudopull/4571/head
commit
ce74af2d08
|
@ -23,6 +23,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -174,6 +175,15 @@ func runStart(cmd *cobra.Command, args []string) {
|
||||||
console.OutStyle(console.Happy, "minikube %s on %s (%s)", version.GetVersion(), runtime.GOOS, runtime.GOARCH)
|
console.OutStyle(console.Happy, "minikube %s on %s (%s)", version.GetVersion(), runtime.GOOS, runtime.GOARCH)
|
||||||
validateConfig()
|
validateConfig()
|
||||||
|
|
||||||
|
currentUser, err := user.Current()
|
||||||
|
|
||||||
|
// Display warning if minikube is being started with root and vmDriver is not HyperV
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("Error getting the current user: %v", err)
|
||||||
|
} else if currentUser.Name == "root" && !(viper.GetString(vmDriver) == "hyperv" || viper.GetString(vmDriver) == "none") {
|
||||||
|
console.OutStyle(console.WarningType, "Please don't run minikube as root or with 'sudo' privileges. It isn't necessary.")
|
||||||
|
}
|
||||||
|
|
||||||
oldConfig, err := cfg.Load()
|
oldConfig, err := cfg.Load()
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
exit.WithCode(exit.Data, "Unable to load config: %v", err)
|
exit.WithCode(exit.Data, "Unable to load config: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue