From 27edd463b00f2f37a36f93eda62b2c6d8b0ca9a3 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 22 Jul 2022 07:38:37 +0200 Subject: Allow for both list and string in sendEmail() to= --- jobs/JobBase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'jobs') diff --git a/jobs/JobBase.py b/jobs/JobBase.py index 8763126..4d01ac6 100755 --- a/jobs/JobBase.py +++ b/jobs/JobBase.py @@ -143,7 +143,7 @@ class JobBase(object): log.warn(self.getName() + " did not override onStateChangeSuccess") return True -def sendEmail(config, subject, body, to=""): +def sendEmail(config, subject, body, to=None): if config.getboolean('email', 'nomail'): logging.info("Not sending email with subject '" + subject + '" but pretending we did.\n' + body) return True @@ -154,6 +154,8 @@ def sendEmail(config, subject, body, to=""): if not to: to = config.get('general', 'alertcontact') + if not isinstance(to, list): + to = [to] # Prepare actual message # Avoid gmail threading -- cgit v1.2.3