-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide warning message for unnecessary sudo #4455
Conversation
Welcome @djmgit! |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Hi @djmgit. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Can one of the admins verify this patch? |
/assign @tstromberg |
I signed it |
cmd/minikube/cmd/start.go
Outdated
currentUser, err := user.Current() | ||
|
||
// Display warning if minikube is being started with root and vmDriver is not hyperv | ||
if err == nil && currentUser.Name == "root" && viper.GetString(vmDriver) != "hyperv" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you check if this works under windows too ? is it called "root" or "admin" or "adminstrator" in windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sudo (or running as root) is required, when using the none
driver (as a special case).
Thanks for making this PR, I am excited to review the PR. could you please sign the CLA? |
@medyagh I will make the changes you suggested and update my PR soon. |
no you don't need to create the a new PR, just make sure to use the same email for git that is used in linux foundation. (https://help.github.com/en/articles/setting-your-commit-email-address-in-git) |
cmd/minikube/cmd/start.go
Outdated
currentUser, err := user.Current() | ||
|
||
// Display warning if minikube is being started with root and vmDriver is not hyperv | ||
if err == nil && currentUser.Name == "root" && viper.GetString(vmDriver) != "hyperv" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sudo (or running as root) is required, when using the none
driver (as a special case).
@afbjorklund cool, will add that case too |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: djmgit The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I signed it |
@medyagh I have updated my PR to log a message when err is not nil. Also I have added the case mentioned by @afbjorklund |
@minikube-bot okay to test |
Yeah, testing whether a Windows users has raised privileges is a little bit tricky, but there are ways to do it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add none driver also to the ones exempt from warning
@medyagh I have already considered none driver case after @afbjorklund pointed it out. |
@medyagh is there anything more needed in this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change the fmt to glog.Errorf
@medyagh done |
cmd/minikube/cmd/start.go
Outdated
|
||
// Display warning if minikube is being started with root and vmDriver is not HyperV | ||
if err != nil { | ||
glog.Errorln("Error getting the current user: ", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please always use %v for errror.
like glog.Errorf("Error getting the current user %v", err)
@minikube-bot OK to test |
@medyagh should I update it, or is it alright? |
for err it is always better to use %v, lets use %v for err |
If minikube is started with root privilege and vm-driver is not hyperV or none, then a warning message is displayed.
@medyagh done |
Awesome thanks for the contribution and your patience to make quality code on minikube, It looks good to me after the tests run. |
@minikube-bot OK to test |
Fixes #4420. If minikube is started with root privilege and vm-driver is
not hyperV or none, then a warning message is displayed.