Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Commit

Permalink
Merge pull request #312 from dpensi/fix-api-v1
Browse files Browse the repository at this point in the history
changed impact type
  • Loading branch information
dpensi authored Oct 19, 2021
2 parents 2f0e304 + a9723d8 commit b56df7e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions checker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package main
import (
"flag"
"fmt"
"strconv"
"strings"

"github.com/RedHatInsights/insights-operator-utils/logger"
Expand Down Expand Up @@ -123,7 +122,7 @@ func checkRuleContent(groupCfg groupConfigMap) {
// For every error code of the rule.
for errCode, errContent := range ruleContent.ErrorKeys {
checkErrorCodeAttributeNotEmpty(ruleName, errCode, "description", errContent.Metadata.Description)
checkErrorCodeAttributeNotEmpty(ruleName, errCode, "impact", strconv.Itoa(errContent.Metadata.Impact))
checkErrorCodeAttributeNotEmpty(ruleName, errCode, "impact", errContent.Metadata.Impact.Name)
checkErrorCodeAttributeNotEmpty(ruleName, errCode, "publish_date", errContent.Metadata.PublishDate)
checkErrorCodeAttributeNotEmpty(ruleName, errCode, "status", errContent.Metadata.Status)
checkErrorCodeAttributeNotEmpty(ruleName, errCode, "likelihood", fmt.Sprint(errContent.Metadata.Likelihood))
Expand Down
2 changes: 1 addition & 1 deletion deploy/clowdapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ parameters:
value: "true"
required: true
- name: CLOUDWATCH_DEBUG
value: "true"
value: "false"
required: true
- name: ICS_LOG_STREAM
value: $HOSTNAME
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/BurntSushi/toml v0.3.1
github.com/RedHatInsights/insights-operator-utils v1.21.0
github.com/RedHatInsights/insights-operator-utils v1.21.2
github.com/go-yaml/yaml v2.1.0+incompatible
github.com/gorilla/mux v1.8.0
github.com/prometheus/client_golang v1.10.0
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ github.com/RedHatInsights/insights-operator-utils v1.19.2 h1:tJ6DHdNJMUorQf4R1hd
github.com/RedHatInsights/insights-operator-utils v1.19.2/go.mod h1:B2hizFGwXCc8MT34QqVJ1A8ANTyGQZQWXQw/gSCEsaU=
github.com/RedHatInsights/insights-operator-utils v1.21.0 h1:P688UpKrbLJ5pbLj0j3qRanROPl/eKv4ieFm7UyUSB4=
github.com/RedHatInsights/insights-operator-utils v1.21.0/go.mod h1:B2hizFGwXCc8MT34QqVJ1A8ANTyGQZQWXQw/gSCEsaU=
github.com/RedHatInsights/insights-operator-utils v1.21.2 h1:xE2VyoOr+7LWAT59D234/n4PW6PlkV1wAOrJPDtCOoE=
github.com/RedHatInsights/insights-operator-utils v1.21.2/go.mod h1:3Pfsgsi7GCu2wgIqQlt1llpyQyyxsDWEGdgnPvadM40=
github.com/RedHatInsights/insights-results-aggregator v0.0.0-20200604090056-3534f6dd9c1c/go.mod h1:7Pc15NYXErx7BMJ4rF1Hacm+29G6atzjhwBpXNFMt+0=
github.com/RedHatInsights/insights-results-aggregator-data v0.0.0-20200825113234-e84e924194bc/go.mod h1:DcDgoCCmBuUSKQOGrTi0BfFLdSjAp/KxIwyqKUd46sM=
github.com/RedHatInsights/insights-results-aggregator-data v0.0.0-20201014142608-de97c4b07d5c/go.mod h1:x8IvreR2g24veCKVMXDPOR6a0D86QK9UCBfi5Xm5Gnc=
Expand All @@ -48,6 +50,7 @@ github.com/RedHatInsights/insights-results-aggregator-data v1.0.1-0.202106140729
github.com/RedHatInsights/insights-results-aggregator-data v1.0.1-0.20210614072933-b25730b1e023/go.mod h1:SDeBuNY8AIwkD4JB5/I54ArWG7qngP5/Ydn7xbu2iZo=
github.com/RedHatInsights/insights-results-aggregator-data v1.1.2 h1:r522n6apxrTa1hKthDO9RnST2OyjE3JTlWG3LDZnBh8=
github.com/RedHatInsights/insights-results-aggregator-data v1.1.2/go.mod h1:rbiccYJ8whbpLLvNGMiaFzyMPs1A/2/Jh0P2U9DXF+4=
github.com/RedHatInsights/insights-results-aggregator-data v1.3.1/go.mod h1:Ylo2cWFmraBzkwKLew54kZSsUTgeVvFJdIi/oRkdxtc=
github.com/RedHatInsights/kafka-zerolog v0.0.0-20210304172207-928f026dc7ec h1:/msFfckx6EIj0rZncrMUfNixFvsLbOiRIe4J0AurhDo=
github.com/RedHatInsights/kafka-zerolog v0.0.0-20210304172207-928f026dc7ec/go.mod h1:HJul5oCsCRNiRlh/ayJDGdW3PzGlid/5aaQwJBn7was=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
Expand Down
5 changes: 3 additions & 2 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ type ReceivedErrorKeyMetadata struct {
func (r ReceivedErrorKeyMetadata) ToErrorKeyMetadata(impactDict map[string]int) types.ErrorKeyMetadata {
returnVal := types.ErrorKeyMetadata{}
returnVal.Description = r.Description
impact, found := impactDict[r.Impact]
impactNumber, found := impactDict[r.Impact]
if !found {
log.Error().Msgf(`impact "%v" doesn't have integer representation' (skipping)`, r.Impact)
}
returnVal.Impact = impact
returnVal.Impact.Impact = impactNumber
returnVal.Impact.Name = r.Impact
returnVal.Likelihood = r.Likelihood
returnVal.PublishDate = r.PublishDate
returnVal.Status = r.Status
Expand Down
2 changes: 1 addition & 1 deletion types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestToErrorKeyMetadata(t *testing.T) {

testResult := receivedErroKey.ToErrorKeyMetadata(testImpactDict)
assert.Equal(t, "test description", testResult.Description)
assert.Equal(t, 5, testResult.Impact)
assert.Equal(t, 5, testResult.Impact.Impact)
assert.Equal(t, 2, testResult.Likelihood)
assert.Equal(t, "12/08/1988", testResult.PublishDate)
assert.Equal(t, "test status", testResult.Status)
Expand Down

0 comments on commit b56df7e

Please sign in to comment.