Alerting integration use get for receiver key (#2894)

# What this PR does
Fixes an issue where OnCall could not parse Alerting configuration if
there was a route created without a receiver. The case where this comes
up is a notification policy matcher is defined for the purpose of
ignoring certain label values before continuing on to other matching
rules.

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
This commit is contained in:
Michael Derynck 2023-08-28 20:01:45 -06:00 committed by GitHub
parent 5bc7351671
commit 5d4f96ec96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Address bug when a Shift Swap Request is accepted either via the web or mobile UI, and the Slack message is not
updated to reflect the latest state by @joeyorlando ([#2886](https://github.com/grafana/oncall/pull/2886))
- Fix issue where Grafana integration would fail to parse alerting config for routes without receivers @mderynck
([#2894](https://github.com/grafana/oncall/pull/2894))
## v1.3.27 (2023-08-25)

View file

@ -374,7 +374,7 @@ class GrafanaAlertingSyncManager:
return True
routes = route_config.get("routes", [])
for route in routes:
if route["receiver"] == receiver_name:
if route.get("receiver") == receiver_name:
return True
if route.get("routes"):
if self._recursive_check_contact_point_is_in_routes(route, receiver_name):