From 432a5614dd53758be85e7c521578ebc59e27a8ce Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sun, 29 Aug 2021 16:27:05 +0200 Subject: [PATCH] Fix the letsencrypt script to actually ignore "no action" notifications --- sysadmin/letsencrypt_mail.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sysadmin/letsencrypt_mail.py b/sysadmin/letsencrypt_mail.py index 749da29..fd9fd7c 100755 --- a/sysadmin/letsencrypt_mail.py +++ b/sysadmin/letsencrypt_mail.py @@ -6,8 +6,6 @@ from enum import Enum import fileinput -import sys -import select import drymail # Vendored @@ -44,16 +42,18 @@ def main(): elif "unexpected error occurred" in line: state = State.error - if state is not State.no_action: - text = "\n".join(text) - subject = SUBJECT.format(str(state)) - message = drymail.Message( - sender=("Certbot renewal bot", "notify@dennogumi.org"), - receivers=["root"], - subject=subject, - headers=HEADER, - text=text - ) + if state is State.no_action: + return + + text = "\n".join(text) + subject = SUBJECT.format(str(state)) + message = drymail.Message( + sender=("Certbot renewal bot", "notify@dennogumi.org"), + receivers=["root"], + subject=subject, + headers=HEADER, + text=text + ) client = drymail.SMTPMailer( host='localhost')