]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/alerts: Add Date header to mails sent by alerts module 46311/head
authorLorenz Bausch <info@lorenzbausch.de>
Tue, 8 Mar 2022 13:45:03 +0000 (14:45 +0100)
committerBoris Ranto <branto@redhat.com>
Wed, 18 May 2022 05:57:34 +0000 (07:57 +0200)
Signed-off-by: Lorenz Bausch <info@lorenzbausch.de>
(cherry picked from commit 4031917739c1e17d909a3fd53fb74fd0fc86030a)

src/pybind/mgr/alerts/module.py

index 5031b39a7ad7537f3ef3e4c3f4c7f6b1514ce6f2..f20f047162d01730a77037fab41700d9f1b50109 100644 (file)
@@ -4,7 +4,7 @@ A simple cluster health alerting module.
 """
 
 from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule, Option
-from email.utils import make_msgid
+from email.utils import formatdate, make_msgid
 from threading import Event
 from typing import Any, Optional, Dict, List, TYPE_CHECKING, Union
 import json
@@ -205,13 +205,15 @@ class Alerts(MgrModule):
                    'Subject: {status}\n'
                    'To: {target}\n'
                    'Message-Id: {message_id}\n'
+                   'Date: {date}\n'
                    '\n'
                    '{status}\n'.format(
                        sender=self.smtp_sender,
                        from_name=self.smtp_from_name,
                        status=status['status'],
                        target=self.smtp_destination,
-                       message_id=make_msgid()))
+                       message_id=make_msgid(),
+                       date=formatdate()))
 
         if 'new' in diff:
             message += ('\n--- New ---\n')