Skip to content

Commit 6cbe188

Browse files
Fix incorrect result URI for pass and warn outcomes in common status analyzer (#1333)
* fix result URI * revert examples * fix warn outcome
1 parent 86279b4 commit 6cbe188

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/preflight/host/cpu.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ spec:
1919
message: At least 16 CPU cores preferred
2020
- pass:
2121
message: This server has sufficient CPU cores
22-

pkg/analyze/common_status.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package analyzer
22

33
import (
44
"fmt"
5-
"github.com/pkg/errors"
6-
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
75
"strconv"
86
"strings"
7+
8+
"github.com/pkg/errors"
9+
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
910
)
1011

1112
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
6465
if exists == false && outcome.Warn.When != "absent" {
6566
result.IsFail = true
6667
result.Message = fmt.Sprintf("The %s %q was not found", resourceType, name)
67-
result.URI = outcome.Fail.URI
68+
result.URI = outcome.Warn.URI
6869
return result, nil
6970
}
7071

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

0 commit comments

Comments
 (0)