Skip to content

Commit

Permalink
Fix incorrect result URI for pass and warn outcomes in common status …
Browse files Browse the repository at this point in the history
…analyzer (#1333)

* fix result URI
* revert examples
* fix warn outcome
  • Loading branch information
diamonwiggins authored Sep 15, 2023
1 parent 86279b4 commit 6cbe188
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion examples/preflight/host/cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ spec:
message: At least 16 CPU cores preferred
- pass:
message: This server has sufficient CPU cores

9 changes: 5 additions & 4 deletions pkg/analyze/common_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package analyzer

import (
"fmt"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"strconv"
"strings"

"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
)

func commonStatus(outcomes []*troubleshootv1beta2.Outcome, name string, iconKey string, iconURI string, readyReplicas int, exists bool, resourceType string) (*AnalyzeResult, error) {
Expand Down Expand Up @@ -64,7 +65,7 @@ func commonStatus(outcomes []*troubleshootv1beta2.Outcome, name string, iconKey
if exists == false && outcome.Warn.When != "absent" {
result.IsFail = true
result.Message = fmt.Sprintf("The %s %q was not found", resourceType, name)
result.URI = outcome.Fail.URI
result.URI = outcome.Warn.URI
return result, nil
}

Expand Down Expand Up @@ -104,7 +105,7 @@ func commonStatus(outcomes []*troubleshootv1beta2.Outcome, name string, iconKey
if exists == false && outcome.Pass.When != "absent" {
result.IsFail = true
result.Message = fmt.Sprintf("The %s %q was not found", resourceType, name)
result.URI = outcome.Fail.URI
result.URI = outcome.Pass.URI
return result, nil
}

Expand Down

0 comments on commit 6cbe188

Please sign in to comment.