Skip to content

Commit

Permalink
delete require profile/machine name
Browse files Browse the repository at this point in the history
This changeset makes it necessary to pass a profile/machine name in order
to delete. This would help avoid accidental deletion of machine by just
delete command.
  • Loading branch information
darkowlzz committed Jul 20, 2017
1 parent 9e8ef22 commit a43e5e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions cmd/minikube/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ import (

// deleteCmd represents the delete command
var deleteCmd = &cobra.Command{
Use: "delete",
Short: "Deletes a local kubernetes cluster",
Long: `Deletes a local kubernetes cluster. This command deletes the VM, and removes all
associated files.`,
Use: "delete MINIKUBE_PROFILE_NAME",
Short: "Deletes a local kubernetes cluster under a given profile",
Long: `Deletes a local kubernetes cluster under a given profile. This command deletes
the VM, and removes all associated files.`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
fmt.Fprintln(os.Stderr, "usage: minikube delete MINIKUBE_PROFILE_NAME")
os.Exit(1)
}

fmt.Println("Deleting local Kubernetes cluster...")
api, err := machine.NewAPIClient()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/start_stop_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestStartStop(t *testing.T) {
Args: *args,
BinaryPath: *binaryPath,
T: t}
runner.RunCommand("delete", false)
runner.RunCommand("delete minikube", false)
runner.CheckStatus(state.None.String())

runner.Start()
Expand Down Expand Up @@ -63,6 +63,6 @@ func TestStartStop(t *testing.T) {
runner.Start()
runner.CheckStatus(state.Running.String())

runner.RunCommand("delete", true)
runner.RunCommand("delete minikube", true)
runner.CheckStatus(state.None.String())
}

0 comments on commit a43e5e1

Please sign in to comment.