Make sure we stop the localkube binary before starting another instance.

This makes "minikube start" re-entrant.
pull/115/head
dlorenc 2016-05-25 13:05:30 -07:00
parent 647124b7c7
commit d8e12ef42b
3 changed files with 5 additions and 2 deletions

View File

@ -148,7 +148,7 @@ type MachineConfig struct {
// StartCluster starts a k8s cluster on the specified Host.
func StartCluster(h sshAble) error {
commands := []string{startCommand}
commands := []string{stopCommand, startCommand}
for _, cmd := range commands {
output, err := h.RunSSHCommand(cmd)

View File

@ -96,7 +96,7 @@ func TestStartCluster(t *testing.T) {
t.Fatalf("Error starting cluster: %s", err)
}
for _, cmd := range []string{startCommand} {
for _, cmd := range []string{stopCommand, startCommand} {
if _, ok := h.Commands[cmd]; !ok {
t.Fatalf("Expected command not run: %s. Commands run: %s", cmd, h.Commands)
}

View File

@ -20,3 +20,6 @@ var startCommand = `
# Run with nohup so it stays up. Redirect logs to useful places.
PATH=/usr/local/sbin:$PATH nohup sudo /usr/local/bin/localkube start --generate-certs=false > /var/log/localkube.out 2> /var/log/localkube.err < /dev/null &
`
// Kill any running instances.
var stopCommand = "killall localkube | true"