From cbc4b16f8f22517c7f651a7a0a3ef3c23ad484c8 Mon Sep 17 00:00:00 2001 From: Abel Luck Date: Wed, 30 Nov 2022 16:11:09 +0000 Subject: [PATCH] Be explicit that an alarm was resolved --- ops_bot/aws.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ops_bot/aws.py b/ops_bot/aws.py index c3a9170..0441cd2 100644 --- a/ops_bot/aws.py +++ b/ops_bot/aws.py @@ -34,16 +34,22 @@ def handle_json_notification(payload: Any, body: Any) -> Tuple[str, str]: subject = payload.get("Subject") state_value = payload.get("NewStateValue", "unknown") - plain = f"{subject}\n{description}" if state_value == "ALARM": color = COLOR_ALARM elif state_value == "OK": color = COLOR_OK else: color = COLOR_UNKNOWN - formatted = ( - f"{subject}\n

{description}

" - ) + + plain = f"{subject}" + formatted = f"{subject}\n" + + if state_value == "OK": + plain += "\n(this alarm has been resolved!)" + formatted += "\n

(this alarm has been resolved!)

" + else: + plain += "\n{description}" + formatted += f"\n

{description}

" return plain, formatted