Fix contact point auto-creation (#2721)
This commit is contained in:
parent
c855258018
commit
bb97bdde2d
2 changed files with 16 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Fix schedule final_events datetime filtering when splitting override ([#2715](https://github.com/grafana/oncall/pull/2715))
|
||||
- Fix swap requests event filter limits in schedule events ([#2716](https://github.com/grafana/oncall/pull/2716))
|
||||
- Fix Alerting contact point auto-creation ([2721](https://github.com/grafana/oncall/pull/2721))
|
||||
|
||||
## v1.3.21 (2023-08-01)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from emoji import emojize
|
|||
from apps.alerts.grafana_alerting_sync_manager.grafana_alerting_sync import GrafanaAlertingSyncManager
|
||||
from apps.alerts.integration_options_mixin import IntegrationOptionsMixin
|
||||
from apps.alerts.models.maintainable_object import MaintainableObject
|
||||
from apps.alerts.tasks import disable_maintenance
|
||||
from apps.alerts.tasks import disable_maintenance, sync_grafana_alerting_contact_points
|
||||
from apps.base.messaging import get_messaging_backend_from_id
|
||||
from apps.base.utils import live_settings
|
||||
from apps.integrations.legacy_prefix import remove_legacy_prefix
|
||||
|
|
@ -652,6 +652,20 @@ def listen_for_alertreceivechannel_model_save(
|
|||
|
||||
metrics_add_integration_to_cache(instance)
|
||||
|
||||
if instance.integration in {
|
||||
AlertReceiveChannel.INTEGRATION_GRAFANA_ALERTING,
|
||||
AlertReceiveChannel.INTEGRATION_LEGACY_GRAFANA_ALERTING,
|
||||
}:
|
||||
if created:
|
||||
instance.grafana_alerting_sync_manager.create_contact_points()
|
||||
# do not trigger sync contact points if field "is_finished_alerting_setup" was updated
|
||||
elif (
|
||||
kwargs is None
|
||||
or not kwargs.get("update_fields")
|
||||
or "is_finished_alerting_setup" not in kwargs["update_fields"]
|
||||
):
|
||||
sync_grafana_alerting_contact_points.apply_async((instance.pk,), countdown=5)
|
||||
|
||||
elif instance.deleted_at:
|
||||
metrics_remove_deleted_integration_from_cache(instance)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue