Skip to content

Commit 0445703

Browse files
Merge pull request #450 from MateSaary/experimental-flag-fix
Fix obtaining of "experimental enabled" env variable
2 parents 6721d3e + ef698c0 commit 0445703

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cadctl/cmd/investigate/investigate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"os"
2222
"path/filepath"
23+
"strconv"
2324
"strings"
2425

2526
cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
@@ -87,7 +88,8 @@ func run(cmd *cobra.Command, _ []string) error {
8788
}
8889
}()
8990

90-
_, cadExperimentalEnabled := os.LookupEnv("CAD_EXPERIMENTAL_ENABLED")
91+
experimentalEnabledVar := os.Getenv("CAD_EXPERIMENTAL_ENABLED")
92+
cadExperimentalEnabled, _ := strconv.ParseBool(experimentalEnabledVar)
9193
alertInvestigation := investigations.GetInvestigation(pdClient.GetTitle(), cadExperimentalEnabled)
9294

9395
// Escalate all unsupported alerts

interceptor/pkg/interceptor/pdinterceptor.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"net/http"
1111
"os"
12+
"strconv"
1213
"time"
1314

1415
"github.com/PagerDuty/go-pagerduty/webhookv3"
@@ -141,7 +142,9 @@ func (pdi *PagerDutyInterceptor) Process(ctx context.Context, r *triggersv1.Inte
141142
return interceptors.Failf(codes.InvalidArgument, "could not initialize pagerduty client: %v", err)
142143
}
143144

144-
_, cadExperimentalEnabled := os.LookupEnv("CAD_EXPERIMENTAL_ENABLED")
145+
experimentalEnabledVar := os.Getenv("CAD_EXPERIMENTAL_ENABLED")
146+
cadExperimentalEnabled, _ := strconv.ParseBool(experimentalEnabledVar)
147+
145148
investigation := investigations.GetInvestigation(pdClient.GetTitle(), cadExperimentalEnabled)
146149
// If the alert is not in the whitelist, return `Continue: false` as interceptor response
147150
// and escalate the alert to SRE

0 commit comments

Comments
 (0)