Skip to content

Commit

Permalink
Merge pull request #40 from phanipadala/fix_39
Browse files Browse the repository at this point in the history
Initialize retryCount value
  • Loading branch information
lilwan authored Oct 18, 2021
2 parents d73e118 + d83c2df commit 2783cbb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions controllers/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,15 @@ func (r *Client) PatchWfAlertAndAlertsConfigStatus(
log = log.WithValues("wfAlertCR", wfAlert.Name, "alertsConfigCR", alertsConfig.Name)
alertStatus.LastUpdatedTimestamp = metav1.Now()
alertStatusBytes, _ := json.Marshal(alertStatus)
patch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\", \"alertsStatus\":{\"%s\":%s}}}", state, wfAlert.Name, string(alertStatusBytes)))
retryCount := alertsConfig.Status.RetryCount
patch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\", \"retryCount\": %d, \"alertsStatus\":{\"%s\":%s}}}", state, retryCount, wfAlert.Name, string(alertStatusBytes)))
_, err := r.PatchStatus(ctx, alertsConfig, client.RawPatch(types.MergePatchType, patch), state, requeueTime...)
if err != nil {
log.Error(err, "unable to patch the status for alerts config object")
return err
}
wfAlertStatusPatch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\",\"alertsStatus\":{\"%s\":%s}}}", state, alertsConfig.Name, string(alertStatusBytes)))
wfRetryCount := wfAlert.Status.RetryCount
wfAlertStatusPatch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\", \"retryCount\": %d,\"alertsStatus\":{\"%s\":%s}}}", state, wfRetryCount, alertsConfig.Name, string(alertStatusBytes)))
if err != nil {
log.Error(err, "unable to patch the status for wavefront alert object")
return err
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.16.0
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect
//golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect
golang.org/x/tools v0.1.7 // indirect
k8s.io/api v0.19.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef h1:fPxZ3Umkct3LZ8gK9nbk+DWDJ
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 h1:KzbpndAYEM+4oHRp9JmB2ewj0NHHxO3Z0g7Gus2O1kk=
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down

0 comments on commit 2783cbb

Please sign in to comment.