fixme: Bypas various bad designe choices

This commit is contained in:
Colin Goutte 2021-11-14 21:21:29 +01:00
parent 4dce2bd91d
commit 148e6416c9
1 changed files with 10 additions and 4 deletions

View File

@ -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: