From 73aefd070e67719443c4abe8490868425814974a Mon Sep 17 00:00:00 2001 From: Deepika Pandhi Date: Sat, 7 Sep 2019 11:04:09 -0700 Subject: [PATCH 1/2] fix in dashboard.go to display dashborad url with root --- cmd/minikube/cmd/dashboard.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index ca1192ae0ded..7678e5883746 100644 --- a/cmd/minikube/cmd/dashboard.go +++ b/cmd/minikube/cmd/dashboard.go @@ -23,6 +23,7 @@ import ( "net/http" "os" "os/exec" + "os/user" "regexp" "time" @@ -128,7 +129,12 @@ var dashboardCmd = &cobra.Command{ exit.WithCodeT(exit.Unavailable, "{{.url}} is not accessible: {{.error}}", out.V{"url": url, "error": err}) } - if dashboardURLMode { + //check if current user is root + user, err := user.Current() + if err != nil { + exit.WithError("Unable to get current user", err) + } + if dashboardURLMode && user.Uid == "0" { out.Ln(url) } else { out.T(out.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url}) From 814c8e1c175beda3bf87ba9c72d004b2a2f8a4d6 Mon Sep 17 00:00:00 2001 From: dpandhi-git Date: Mon, 9 Sep 2019 13:38:01 -0700 Subject: [PATCH 2/2] updated || for condition if dashboardURLMode && user.Uid as per comments #5292 --- cmd/minikube/cmd/dashboard.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index 7678e5883746..ce25462c38bc 100644 --- a/cmd/minikube/cmd/dashboard.go +++ b/cmd/minikube/cmd/dashboard.go @@ -134,7 +134,7 @@ var dashboardCmd = &cobra.Command{ if err != nil { exit.WithError("Unable to get current user", err) } - if dashboardURLMode && user.Uid == "0" { + if dashboardURLMode || user.Uid == "0" { out.Ln(url) } else { out.T(out.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})