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

fix "profile list" timing out when cluster stopped. #9557

Merged
merged 2 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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