Skip to content
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

UI: Advice when user tries to set profile name to "delete" or "start" #4883

Closed
medyagh opened this issue Jul 26, 2019 · 27 comments · Fixed by #5624
Closed

UI: Advice when user tries to set profile name to "delete" or "start" #4883

medyagh opened this issue Jul 26, 2019 · 27 comments · Fixed by #5624
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/ui Categorizes an issue or PR as relevant to SIG UI.

Comments

@medyagh
Copy link
Member

medyagh commented Jul 26, 2019

to delete a minikube profile you need to do

minikube delete -p prof_name

but if you do

minikube profile delete

it will actually create a profile named delete. because that command sets profile name.

we need to at lest add an advice to the user, that says

Did you mean to delete a profile ? and here is the command to delete profile !

I recommend the same approach for other key words such as, start, stop, status, ... to make it less confusing for new users.

we could add this to the Unit tests of profile, so if someone tries to set the profile name to a list of reserved words, it should return an error.

@medyagh medyagh added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. needs-solution-message Issues where where offering a solution for an error would be helpful sig/ui Categorizes an issue or PR as relevant to SIG UI. labels Jul 26, 2019
@medyagh medyagh changed the title advice user when trying to set profile name to "delete" UI: advice user when trying to set profile name to "delete" Jul 26, 2019
@medyagh medyagh changed the title UI: advice user when trying to set profile name to "delete" UI: Advice when user tries to set profile name to "delete" or "start" Jul 26, 2019
@bhanu-lab
Copy link
Contributor

i would like to pick this up. /assign

@bhanu-lab
Copy link
Contributor

/assign

@medyagh
Copy link
Member Author

medyagh commented Jul 27, 2019

its yours ! @bhanu011 let me know if you need help

@bhanu011 I just updated the description, we need to have a unit test for profile that checks for a list of reservered words and returns error if you try to set that name

@bhanu-lab
Copy link
Contributor

bhanu-lab commented Jul 28, 2019

@medyagh when user tries to create profiles with reserved keywords(delete, start, stop, status, etc ...) system should restrict the user from creating and throw an error?
If that is the scenario i will use exit.WithError() for throwing errors

@medyagh
Copy link
Member Author

medyagh commented Jul 28, 2019

I would say exit with an Advice, and yes it should not allow you create a profile in the reserved names.

the reserved names could be the basic commands,
start,stop, status, delete, config

@medyagh
Copy link
Member Author

medyagh commented Jul 29, 2019

@bhanu011 we had a discussion on this in minikube office hours.

Please sync with @josedonizetti to handle this issue

@bhanu-lab
Copy link
Contributor

@medyagh ok @josedonizetti any changes to the design discussed in above comments?

@medyagh
Copy link
Member Author

medyagh commented Jul 29, 2019

@bhanu011 yes we had a change in design, you could still work on it if you like, please sync with @josedonizetti for any help you need with this PR !

@josedonizetti
Copy link
Member

josedonizetti commented Jul 29, 2019

@bhanu011 Currently if you do minikube profiler <NAME> this will create a new profile with the given name, and switch you to it. After discussing this today we thought that profile creation should only happen by the start command, and the profile should be only used to switch among existing profiles.

Basically, we need to change profile to validate if a profile exists before switching and if not warn the user.

Let me know if you still want to work on this! And if you have any questions. :)

@bhanu-lab
Copy link
Contributor

bhanu-lab commented Jul 29, 2019

@josedonizetti i am done with code according to previous design i was just writing unit test cases. I would like to continue working on this. Here are few questions I have

  1. where can i get all existing profiles? is it from this folder~/.minikube/profiles/ or is there any better way?
  2. What should happen when user trying to create profiles with kind of reserved words like delete, stop etc? Do we need to allow the user to create profile with that name?
  3. If we are allowing we should only show some advice like if you are looking for this try with this command ?

@josedonizetti
Copy link
Member

josedonizetti commented Jul 29, 2019

@bhanu011

  1. https://github.com/kubernetes/minikube/blob/master/pkg/minikube/config/profile.go#L40
  2. Yup, no validation here, if the user intentionally do minikube start -p delete it's okay
  3. Didn't understand the question.

@bhanu-lab
Copy link
Contributor

  1. If user tries to create profile with minikube profile delete do we need to show any info message like use minikube delete -p prof_name for deleting

@josedonizetti
Copy link
Member

josedonizetti commented Jul 29, 2019

@bhanu011 That's the thing, minikube profile won't create profiles anymore. It will be only to switch among existing profiles, creating will only be done by minikube start -p <PROFILE_NAME>.

@bhanu-lab
Copy link
Contributor

@josedonizetti ok got it, i will implement changes

@josedonizetti josedonizetti removed their assignment Aug 1, 2019
@tstromberg tstromberg added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Aug 1, 2019
@bhanu-lab
Copy link
Contributor

bhanu-lab commented Aug 2, 2019

@medyagh @josedonizetti sorry for posting here, but i am getting below error when doing go build

# k8s.io/minikube/pkg/minikube/translate
../../pkg/minikube/translate/translate.go:77:12: undefined: Asset

Could you please help on this I am not able to find root cause/fix

@josedonizetti
Copy link
Member

josedonizetti commented Aug 2, 2019

@bhanu011 if you rebase from the latest master you shouldn't get this problem when building make, but you also should be able to do to make pkg/minikube/assets/assets.go to regenerate the asset.go

@rzr
Copy link

rzr commented Aug 6, 2019

Relate-to: #4909

@bhanu-lab
Copy link
Contributor

@bhanu011

  1. https://github.com/kubernetes/minikube/blob/master/pkg/minikube/config/profile.go#L40

@josedonizetti looks like valid profiles doesnt return default profile "minikube" which is a valid profile when profile name is given as "default" right?

@josedonizetti
Copy link
Member

josedonizetti commented Aug 15, 2019

@bhanu011 sorry for the delay, was away last week. I have just tested ListProfiles locally and it did list all my 3 profiles as valid, including the default one. Did you rebase your code from master?
Maybe delete/recreate the main profile, might be from an older version?

@sharifelgamal sharifelgamal added the kind/bug Categorizes issue or PR as related to a bug. label Sep 20, 2019
@woodcockjosh
Copy link
Contributor

@bhanu011 @tstromberg when I run minikube profile options it sets the profile to options instead of listing the command options. Will this PR fix this issue?

@nanikjava
Copy link
Contributor

@josedonizetti @medyagh If the original assignee is not working on this I'm happy to take over this issue ?. Let me know. Thanks

@nanikjava
Copy link
Contributor

Looks like this issue need to be closed as it's been merged to master.

@josedonizetti
Copy link
Member

@nanikjava Do you want to work on #4913? I haven't had much time to look into it. Let me know and I'll assign it to you.

@nanikjava
Copy link
Contributor

@josedonizetti yes please assign it to me. Thanks

@woodcockjosh
Copy link
Contributor

woodcockjosh commented Oct 15, 2019

@nanikjava you can assign to yourself by adding a comment with /assign on its own line

@nanikjava
Copy link
Contributor

/assign

nanikjava added a commit to nanikjava/minikube-1 that referenced this issue Oct 15, 2019
Fixes : kubernetes#4883

New function ProfileNameInReservedKeywords(..) has been added inside
pkg/minikube/config/profile.go

The new function perform validation to make sure the profile name is not
in the list of keywords.

Following are the keywords that are used:

start, stop, status, delete, config, open, profile, addons, cache, logs

The checking is case insensitive to cover combo of upper and lower case
@nanikjava
Copy link
Contributor

@josedonizetti PR is ready for review #5624

Thanks

nanikjava added a commit to nanikjava/minikube-1 that referenced this issue Oct 17, 2019
Fixes : kubernetes#4883

New function ProfileNameInReservedKeywords(..) has been added inside
pkg/minikube/config/profile.go

The new function perform validation to make sure the profile name is not
in the list of keywords.

Following are the keywords that are used:

start, stop, status, delete, config, open, profile, addons, cache, logs

The checking is case insensitive to cover combo of upper and lower case
@tstromberg tstromberg removed the needs-solution-message Issues where where offering a solution for an error would be helpful label Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/ui Categorizes an issue or PR as relevant to SIG UI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants