From 148e6416c98ed52050853d61ef530680a0ba2bdb Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Sun, 14 Nov 2021 21:21:29 +0100 Subject: [PATCH] fixme: Bypas various bad designe choices --- papi/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/papi/main.py b/papi/main.py index 093d444..dad945e 100644 --- a/papi/main.py +++ b/papi/main.py @@ -112,8 +112,11 @@ class Notifier: "status": ["Le monitoring est inacessible"], } ) - conf = PROBES[idsonde] - + try: + conf = PROBES[idsonde] + except KeyError: + logger.info(f"{idsonde} not found in probe") + return subject = "Probleme api supervision" content = kind from papi.mail_sendermodel import sendmail @@ -179,7 +182,10 @@ def last_notif_text(request: Request, idsonde: str): try: recipients = sondeid2notifsemails(idsonde) except KeyError: # pragma: no cover - recipients = ["mail1@xxx", "mail2@xxx"] + + # breakpoint() + + recipients = ["mail1@xxx", "mail2@xxx", f"{idsonde}@fqdn"] changements = content["changes"] status = content["status"] @@ -212,7 +218,7 @@ def post_sonde_error( if idsonde != "test": raise LookupError(f"{idsonde} not found") - Notifier.error_sonde(idsonde, body["msg"]) + Notifier.error_sonde(idsonde, body.get("msg")) # create fake sample try: