From b3bb118fa9565fbd5c8ff1c44c1674e9866a763b Mon Sep 17 00:00:00 2001 From: fabrizio benvenuti <fabrizio.benvenuti@seco.com> Date: Tue, 14 Jan 2025 08:53:35 +0100 Subject: [PATCH] [ReportMailer] ensure board_type is uppercase, assert argument types --- scripts/email_reports.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/email_reports.py b/scripts/email_reports.py index b6b34b7..204485c 100644 --- a/scripts/email_reports.py +++ b/scripts/email_reports.py @@ -9,17 +9,17 @@ import os # Set up argument parser parser = argparse.ArgumentParser(description="Send emails to ETMs and the Core Team, based on board type.") -parser.add_argument('--board', required=True, help='Board type (e.g., c61, c12, c20)') +parser.add_argument('--board',type=str, required=True, help='Board type (e.g., c61, c12, c20)') parser.add_argument('--jsonfile', type=argparse.FileType('r'), required=True, help='File variable containing JSON data') -parser.add_argument('--attachment', required=False, default="report.pdf", help='Path to the file to attach (e.g., report.pdf)') -parser.add_argument('--sender', required=True, help='Email address from which the email is sent') -parser.add_argument('--email', required=True, help='Email address for authentication') -parser.add_argument('--password', required=True, help='Password for email authentication') -parser.add_argument('--smtp_server', required=False, default='smtp.office365.com', help='SMTP server address') +parser.add_argument('--attachment',type=str, required=False, default="report.pdf", help='Path to the file to attach (e.g., report.pdf)') +parser.add_argument('--sender',type=str, required=True, help='Email address from which the email is sent') +parser.add_argument('--email',type=str, required=True, help='Email address for authentication') +parser.add_argument('--password',type=str, required=True, help='Password for email authentication') +parser.add_argument('--smtp_server',type=str, required=False, default='smtp.office365.com', help='SMTP server address') parser.add_argument('--smtp_port', type=int, required=False, default='587', help='SMTP server port') args = parser.parse_args() -board_type = args.board +board_type = args.board.upper() json_file = args.jsonfile attachment_path = args.attachment EMAIL_ADDRESS = args.email -- GitLab