From 0430111b4a98b8854a181b81a44c2111067eeea4 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Fri, 15 Sep 2017 08:17:12 +0000
Subject: [PATCH] Task #11254: notify recipients (like sos) when PI/CO email
 address cannot be retreived

---
 .../LTAIngestAdminServer/lib/ingestjobmanagementserver.py    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/lib/ingestjobmanagementserver.py b/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/lib/ingestjobmanagementserver.py
index c456a86432f..72f08ec8b4d 100644
--- a/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/lib/ingestjobmanagementserver.py
+++ b/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/lib/ingestjobmanagementserver.py
@@ -1045,6 +1045,7 @@ Total Files: %(total)i
         done_group_jobs = [jad['job'] for jad in done_group_jads]
         submitters = [j['Submitter'] for j in done_group_jobs if 'Submitter' in j]
         extra_mail_addresses = [j['email'] for j in done_group_jobs if 'email' in j]
+        extra_mail_addresses_error_msg = None
 
         try:
             if len(unfinished_group_jads) == 0:
@@ -1063,7 +1064,9 @@ Total Files: %(total)i
                     if project_details and 'author_email' in project_details:
                         extra_mail_addresses.append(project_details['author_email'])
         except Exception as e:
-            logger.error('error while trying to get PI\'s/Contact-author\'s email address for %s: %s', job_group_id, e)
+            extra_mail_addresses_error_msg = 'error while trying to get PI\'s/Contact-author\'s email address for %s: %s' % (job_group_id, e)
+            logger.error(extra_mail_addresses_error_msg)
+            report += '\n\n' + extra_mail_addresses_error_msg
 
         # submitters might contain comma seperated strings
         # join all sumbitterstrings in one long csv string, split it, and get the unique submitters
-- 
GitLab