Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bosun complaining about `actionBodyForceClose`, `actionBodyDelayedClo` and `actionBodyCancelClose` #2198

Merged
merged 1 commit into from Jan 17, 2018

Conversation

@pradeepbbl
Copy link
Contributor

@pradeepbbl pradeepbbl commented Dec 4, 2017

Bosun complaining about actionBodyForceClose, actionBodyDelayedClose, and actionBodyCancelClose intermediately and causing crash with error couldn't read rules: unknown key actionBodyDelayedClose after looking at the code cmd/bosun/conf/rule/loaders.go#L442 we found strings.HasSuffix sometime getting matched with 'Close' rather then 'DelayedClose, ForceClose or CancelClose' and later it breaks in the switch statement cmd/bosun/conf/rule/loaders.go#L462 due to invalid template type

Debug log:

2017/11/29 11:27:26 enabling syslog
2017/11/29 11:27:26 info: loaders.go:439: Key was: actionBodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:442: Key after trim action: BodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:448: ActionType: Closed
2017/11/29 11:27:26 info: loaders.go:450: Template keyType: BodyDelayed
2017/11/29 11:27:26 fatal: main.go:119: couldn't read rules: conf: test01.conf:34:3: at <actionBodyDelayedClo...>: unknown key actionBodyDelayedClose

In this patch, we try to match the actionType explicitly with strings.Compare

…se`, `actionBodyCancelClose` intermediately and causing crash with error `couldn't read rules: unknown key actionBodyDelayedClose` after looking at the code cmd/bosun/conf/rule/loaders.go#L442 we found strings.HasSuffix sometime getting matched with 'Close' rather then 'DelayedClose, ForceClose or CancelClose' and later it breaks the switch statement cmd/bosun/conf/rule/loaders.go#L462 due to invalid template type

Debug log:
```
2017/11/29 11:27:26 enabling syslog
2017/11/29 11:27:26 info: loaders.go:439: Key was: actionBodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:442: Key after trim action: BodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:448: ActionType: Closed
2017/11/29 11:27:26 info: loaders.go:450: Template keyType: BodyDelayed
2017/11/29 11:27:26 fatal: main.go:119: couldn't read rules: conf: test01.conf:34:3: at <actionBodyDelayedClo...>: unknown key actionBodyDelayedClose
```

In this patch, we try to match the actionType explicitly with strings.Compare
@pradeepbbl
Copy link
Contributor Author

@pradeepbbl pradeepbbl commented Dec 4, 2017

lopping @captncraig for a review :)

@pradeepbbl
Copy link
Contributor Author

@pradeepbbl pradeepbbl commented Jan 9, 2018

@captncraig could you please review this and let me know your thoughts.

@captncraig captncraig merged commit c9590d0 into bosun-monitor:master Jan 17, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
dschneller added a commit to Rheinwerk/bosun that referenced this pull request Feb 26, 2018
* master:
  cmd/scollector: add systemd physical "predictable" linux net interface names (bosun-monitor#1985)
  cmd/bosun: add notification stats to /api/health (bosun-monitor#2222)
  cmd/bosun: native short links replace google (bosun-monitor#2210)
  docs: update system_configuration docs to reflect RedisDb configuration variable (bosun-monitor#2220)
  cmd/bosun/sched/views.go: added new incident filter `since` (bosun-monitor#2215)
  Bosun complaining about `actionBodyForceClose`, `actionBodyDelayedClose`, `actionBodyCancelClose` intermediately and causing crash with error `couldn't read rules: unknown key actionBodyDelayedClose` after looking at the code cmd/bosun/conf/rule/loaders.go#L442 we found strings.HasSuffix sometime getting matched with 'Close' rather then 'DelayedClose, ForceClose or CancelClose' and later it breaks the switch statement cmd/bosun/conf/rule/loaders.go#L462 due to invalid template type (bosun-monitor#2198)
  Update WMI to support int[] (bosun-monitor#2213)
  Add Scheme option to bosun toml (bosun-monitor#2209)
  Changed load sequence for `macros` to use in the notifications (bosun-monitor#2199)
  Fixed wrong nested ul in unknown notify (bosun-monitor#2208)
  travis: remove slack notification / go 1.9 (bosun-monitor#2203)
  Fix post notification logging (bosun-monitor#2196)
clinta added a commit to clinta/bosun that referenced this pull request Mar 9, 2018
…se`, `actionBodyCancelClose` intermediately and causing crash with error `couldn't read rules: unknown key actionBodyDelayedClose` after looking at the code cmd/bosun/conf/rule/loaders.go#L442 we found strings.HasSuffix sometime getting matched with 'Close' rather then 'DelayedClose, ForceClose or CancelClose' and later it breaks the switch statement cmd/bosun/conf/rule/loaders.go#L462 due to invalid template type (bosun-monitor#2198)

Debug log:
```
2017/11/29 11:27:26 enabling syslog
2017/11/29 11:27:26 info: loaders.go:439: Key was: actionBodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:442: Key after trim action: BodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:448: ActionType: Closed
2017/11/29 11:27:26 info: loaders.go:450: Template keyType: BodyDelayed
2017/11/29 11:27:26 fatal: main.go:119: couldn't read rules: conf: test01.conf:34:3: at <actionBodyDelayedClo...>: unknown key actionBodyDelayedClose
```

In this patch, we try to match the actionType explicitly with strings.Compare
pradeepbbl added a commit to pradeepbbl/bosun that referenced this pull request Mar 21, 2018
…se`, `actionBodyCancelClose` intermediately and causing crash with error `couldn't read rules: unknown key actionBodyDelayedClose` after looking at the code cmd/bosun/conf/rule/loaders.go#L442 we found strings.HasSuffix sometime getting matched with 'Close' rather then 'DelayedClose, ForceClose or CancelClose' and later it breaks the switch statement cmd/bosun/conf/rule/loaders.go#L462 due to invalid template type (bosun-monitor#2198)

Debug log:
```
2017/11/29 11:27:26 enabling syslog
2017/11/29 11:27:26 info: loaders.go:439: Key was: actionBodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:442: Key after trim action: BodyDelayedClose
2017/11/29 11:27:26 info: loaders.go:448: ActionType: Closed
2017/11/29 11:27:26 info: loaders.go:450: Template keyType: BodyDelayed
2017/11/29 11:27:26 fatal: main.go:119: couldn't read rules: conf: test01.conf:34:3: at <actionBodyDelayedClo...>: unknown key actionBodyDelayedClose
```

In this patch, we try to match the actionType explicitly with strings.Compare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.