Skip to content

Commit

Permalink
Merge pull request #19728 from prezha/fix-profile-list
Browse files Browse the repository at this point in the history
don't pollute minikube profile list with errors if exitcode is absent
  • Loading branch information
spowelljr authored Sep 30, 2024
2 parents f13b9f1 + 677f757 commit 725afe0
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions pkg/minikube/cluster/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,29 @@ func GetState(sts []*Status, profile string, cc *config.ClusterConfig) State {
finalStep = data
klog.Infof("transient code %d (%q) for step: %+v", transientCode, codeNames[transientCode], data)
}

if ev.Type() == "io.k8s.sigs.minikube.error" {
var data map[string]string
err := ev.DataAs(&data)
if err != nil {
klog.Errorf("unable to parse data: %v\nraw data: %s", err, ev.Data())
continue
}
exitCode, err := strconv.Atoi(data["exitcode"])
if err != nil {
klog.Errorf("exit code not found: %v", err)
continue
// process exit code, if present
if ec, ok := data["exitcode"]; ok && ec != "" {
exitCode, err := strconv.Atoi(ec)
if err != nil {
klog.Errorf("exit code not found: %v", err)
continue
}

if val, ok := exitCodeToHTTPCode[exitCode]; ok {
exitCode = val
}

transientCode = exitCode
}
if val, ok := exitCodeToHTTPCode[exitCode]; ok {
exitCode = val
}
transientCode = exitCode

for _, n := range cs.Nodes {
n.StatusCode = transientCode
n.StatusName = codeNames[n.StatusCode]
Expand Down

0 comments on commit 725afe0

Please sign in to comment.