Skip to content

Commit

Permalink
Merge pull request #1606 from XrXr/stop-crash
Browse files Browse the repository at this point in the history
Don't treat stopping stopped hosts as error
  • Loading branch information
aaron-prindle authored Jun 19, 2017
2 parents 40cb79f + 5d39878 commit e05c378
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/engine"
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/mcnerror"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
Expand Down Expand Up @@ -103,6 +104,10 @@ func StopHost(api libmachine.API) error {
return errors.Wrapf(err, "Error loading host: %s", cfg.GetMachineName())
}
if err := host.Stop(); err != nil {
alreadyInStateError, ok := err.(mcnerror.ErrHostAlreadyInState)
if ok && alreadyInStateError.State == state.Stopped {
return nil
}
return errors.Wrapf(err, "Error stopping host: %s", cfg.GetMachineName())
}
return nil
Expand Down

0 comments on commit e05c378

Please sign in to comment.