community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1757393 - /comdev/projects.apache.org/scripts/cronjobs/parseprojects.py
Date Tue, 23 Aug 2016 15:46:20 GMT
Author: sebb
Date: Tue Aug 23 15:46:20 2016
New Revision: 1757393

URL: http://svn.apache.org/viewvc?rev=1757393&view=rev
Log:
Show failed URL in email body

Modified:
    comdev/projects.apache.org/scripts/cronjobs/parseprojects.py

Modified: comdev/projects.apache.org/scripts/cronjobs/parseprojects.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/parseprojects.py?rev=1757393&r1=1757392&r2=1757393&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/parseprojects.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/parseprojects.py Tue Aug 23 15:46:20 2016
@@ -54,10 +54,10 @@ siteMap = {
 }
 
 # Print to log and send an email (intended for WARN messages)
-def printMail(msg, file=sys.stdout):
+def printMail(msg, file=sys.stdout, body=''):
     print(msg, file=file)
     try:
-        sendmail.sendMail(msg)
+        sendmail.sendMail(msg, body=body)
     except ConnectionRefusedError:
         print("*** Failed to send the email", file=file)
 
@@ -244,7 +244,10 @@ for s in itemlist :
         else:
             printMail("WARN: project ignored since unable to extract project json filename
from %s" % url)
     except Exception as err:
-        printMail("Error when processing doap file %s:" % url, file=sys.stderr)
+        if isinstance(err, OSError): # OSError is parent of HTTPError/URLError 
+            printMail("Error when processing doap file %s:" % url, file=sys.stderr, body=err.filename)
+        else:
+            printMail("Error when processing doap file %s:" % url, file=sys.stderr)
         print("-"*60, file=sys.stderr)
         traceback.print_exc()
         if isinstance(err, OSError): # OSError is parent of HTTPError/URLError 



Mime
View raw message