Skip to content

Commit

Permalink
Merge pull request #9557 from sharifelgamal/fast-stopped
Browse files Browse the repository at this point in the history
fix "profile list" timing out when cluster stopped.
  • Loading branch information
medyagh authored Oct 26, 2020
2 parents 53ba056 + 777ac14 commit c798567
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
11 changes: 11 additions & 0 deletions cmd/minikube/cmd/config/profile_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"k8s.io/minikube/pkg/minikube/style"

"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/state"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"

Expand Down Expand Up @@ -97,6 +98,16 @@ func profileStatus(p *config.Profile, api libmachine.API) string {
return "Unknown"
}

// The machine isn't running, no need to check inside
s, err := host.Driver.GetState()
if err != nil {
klog.Warningf("error getting host state: %v", err)
return "Unknown"
}
if s != state.Running {
return s.String()
}

cr, err := machine.CommandRunner(host)
if err != nil {
klog.Warningf("error loading profiles: %v", err)
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6K
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-getter v1.4.2/go.mod h1:3Ao9Hol5VJsmwJV5BF1GUrONbaOUmA+m1Nj2+0LuMAY=
github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func ListProfiles(miniHome ...string) (validPs []*Profile, inValidPs []*Profile,
if err != nil {
return nil, nil, err
}
// try to get profiles list based on all contrainers created by docker driver
// try to get profiles list based on all containers created by docker driver
cs, err := oci.ListOwnedContainers(oci.Docker)
if err == nil {
pDirs = append(pDirs, cs...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// Profile represents a minikube profile
type Profile struct {
Name string
Status string // running, stopped
Status string // running, stopped, paused, unknown
Config *ClusterConfig
}

Expand Down

0 comments on commit c798567

Please sign in to comment.