Skip to content

Commit

Permalink
Merge pull request kubernetes#15571 from axrav/master
Browse files Browse the repository at this point in the history
refactor: avoiding repetitive code
  • Loading branch information
spowelljr authored Jan 4, 2023
2 parents b62cd4f + 3573ff8 commit afe0f18
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pkg/minikube/registry/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ func Available(vm bool) []DriverState {
klog.Infof("Querying for installed drivers using PATH=%s", os.Getenv("PATH"))

for _, d := range globalRegistry.List() {
if vm && !IsVM(d.Name) {
continue
}
if d.Status == nil {
klog.Errorf("%q does not implement Status", d.Name)
continue
Expand All @@ -123,14 +126,7 @@ func Available(vm bool) []DriverState {
if !s.Healthy {
priority = Unhealthy
}

if vm {
if IsVM(d.Name) {
sts = append(sts, DriverState{Name: d.Name, Default: d.Default, Preference: preference, Priority: priority, State: s})
}
} else {
sts = append(sts, DriverState{Name: d.Name, Default: d.Default, Preference: preference, Priority: priority, State: s})
}
sts = append(sts, DriverState{Name: d.Name, Default: d.Default, Preference: preference, Priority: priority, State: s})
}

// Descending priority for predictability
Expand Down

0 comments on commit afe0f18

Please sign in to comment.