mirror of
https://github.com/ansible/awx.git
synced 2026-05-02 23:25:29 -02:30
Error reporting and handling in GH14575/GH12682 (#14802)
Bug Error reporting and handling in GH14575/GH12682 This targets a bug that tries to parse blank string as None for panelid and dashboardid. It also prints more errors reporting to the console to diagnose reporting issues Co-authored-by: Lila Yasin <lyasin@redhat.com>
This commit is contained in:
@@ -53,8 +53,8 @@ class GrafanaBackend(AWXBaseEmailBackend, CustomNotificationBase):
|
|||||||
):
|
):
|
||||||
super(GrafanaBackend, self).__init__(fail_silently=fail_silently)
|
super(GrafanaBackend, self).__init__(fail_silently=fail_silently)
|
||||||
self.grafana_key = grafana_key
|
self.grafana_key = grafana_key
|
||||||
self.dashboardId = int(dashboardId) if dashboardId is not None else None
|
self.dashboardId = int(dashboardId) if dashboardId is not None and panelId != "" else None
|
||||||
self.panelId = int(panelId) if panelId is not None else None
|
self.panelId = int(panelId) if panelId is not None and panelId != "" else None
|
||||||
self.annotation_tags = annotation_tags if annotation_tags is not None else []
|
self.annotation_tags = annotation_tags if annotation_tags is not None else []
|
||||||
self.grafana_no_verify_ssl = grafana_no_verify_ssl
|
self.grafana_no_verify_ssl = grafana_no_verify_ssl
|
||||||
self.isRegion = isRegion
|
self.isRegion = isRegion
|
||||||
@@ -97,6 +97,7 @@ class GrafanaBackend(AWXBaseEmailBackend, CustomNotificationBase):
|
|||||||
r = requests.post(
|
r = requests.post(
|
||||||
"{}/api/annotations".format(m.recipients()[0]), json=grafana_data, headers=grafana_headers, verify=(not self.grafana_no_verify_ssl)
|
"{}/api/annotations".format(m.recipients()[0]), json=grafana_data, headers=grafana_headers, verify=(not self.grafana_no_verify_ssl)
|
||||||
)
|
)
|
||||||
|
|
||||||
if r.status_code >= 400:
|
if r.status_code >= 400:
|
||||||
logger.error(smart_str(_("Error sending notification grafana: {}").format(r.status_code)))
|
logger.error(smart_str(_("Error sending notification grafana: {}").format(r.status_code)))
|
||||||
if not self.fail_silently:
|
if not self.fail_silently:
|
||||||
|
|||||||
Reference in New Issue
Block a user