Fix incorrect result URI for pass and warn outcomes in common status analyzer (#1333)

* fix result URI
* revert examples
* fix warn outcome
This commit is contained in:
Diamon Wiggins
2023-09-16 07:36:58 +12:00
committed by GitHub
parent 86279b4ec4
commit 6cbe188abe
2 changed files with 5 additions and 5 deletions
-1
View File
@@ -19,4 +19,3 @@ spec:
message: At least 16 CPU cores preferred
- pass:
message: This server has sufficient CPU cores
+5 -4
View File
@@ -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) {
@@ -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
}
@@ -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
}