From fa7582135e6909b1740c8f26fa0dc482a63afe2a Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:09:01 +0200 Subject: [PATCH] Update reporting.py Added new code "VERSION" to report version in report file Added new code "BUILD" to report version in report file Updated "REPORT_DATE" comment tag Updated "SERVER_NAME" comment tag --- pialert/reporting.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pialert/reporting.py b/pialert/reporting.py index 761512df..6a1f24ab 100755 --- a/pialert/reporting.py +++ b/pialert/reporting.py @@ -150,14 +150,25 @@ def send_notifications (db): mail_html = template_file.read() template_file.close() - # Report Header & footer + # Report "REPORT_DATE" in Header & footer timeFormated = timeNowTZ().strftime ('%Y-%m-%d %H:%M') mail_text = mail_text.replace ('', timeFormated) mail_html = mail_html.replace ('', timeFormated) + # Report "SERVER_NAME" in Header & footer mail_text = mail_text.replace ('', socket.gethostname() ) mail_html = mail_html.replace ('', socket.gethostname() ) + # Report "VERSION" in Header & footer + VERSIONFILE = subprocess.check_output(['php', pialertPath + '/front/php/templates/version.php']).decode('utf-8') + mail_text = mail_text.replace ('', VERSIONFILE) + mail_html = mail_html.replace ('', VERSIONFILE) + + # Report "BUILD" in Header & footer + BUILDFILE = subprocess.check_output(['php', pialertPath + '/front/php/templates/build.php']).decode('utf-8') + mail_text = mail_text.replace ('', BUILDFILE) + mail_html = mail_html.replace ('', BUILDFILE) + mylog('verbose', ['[Notification] included sections: ', conf.INCLUDED_SECTIONS ]) if 'internet' in conf.INCLUDED_SECTIONS : @@ -541,4 +552,4 @@ def handle_test(testType): if testType == 'REPORT_PUSHSAFER': send_pushsafer (sample_msg) - mylog('minimal', ['[Test Publishers] END Test: ', testType]) \ No newline at end of file + mylog('minimal', ['[Test Publishers] END Test: ', testType])