Skip to content
Snippets Groups Projects

Include environment name in notification email subject line

Merged Karel van Klink requested to merge feature/distinguish-public-private-hostname into develop
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
@@ -18,10 +18,10 @@ def gather_failed_tasks() -> State:
@@ -18,10 +18,10 @@ def gather_failed_tasks() -> State:
@step("Send notification emails for all failed tasks")
@step("Send notification emails for all failed tasks")
def send_email_notifications(state: State) -> None:
def send_email_notifications(state: State) -> None:
"""Send out an email notification for all tasks that have failed."""
"""Send out an email notification for all tasks that have failed."""
base_url = load_oss_params().GENERAL.public_hostname
general_settings = load_oss_params().GENERAL
all_alerts = ""
all_alerts = ""
for failure in state["failed_tasks"]:
for failure in state["failed_tasks"]:
failed_task_url = f"{base_url}/workflows/{failure["process_id"]}"
failed_task_url = f"{general_settings.public_hostname}/workflows/{failure["process_id"]}"
failed_subscription = get_subscription_by_process_id(failure["process_id"])
failed_subscription = get_subscription_by_process_id(failure["process_id"])
all_alerts = f"{all_alerts}------\n\n"
all_alerts = f"{all_alerts}------\n\n"
if failed_subscription:
if failed_subscription:
@@ -36,7 +36,7 @@ def send_email_notifications(state: State) -> None:
@@ -36,7 +36,7 @@ def send_email_notifications(state: State) -> None:
)
)
send_mail(
send_mail(
"GAP - One or more tasks have failed!",
f"GAP {general_settings.environment} environment - One or more tasks have failed!",
(
(
f"Please check the following tasks in GAP which have failed.\n\n{all_alerts}------"
f"Please check the following tasks in GAP which have failed.\n\n{all_alerts}------"
f"\n\nRegards, the GÉANT Automation Platform.\n\n"
f"\n\nRegards, the GÉANT Automation Platform.\n\n"
Loading