community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1741189 - /comdev/projects.apache.org/scripts/cronjobs/parseprojects.py
Date Wed, 27 Apr 2016 09:51:54 GMT
Author: sebb
Date: Wed Apr 27 09:51:54 2016
New Revision: 1741189

URL: http://svn.apache.org/viewvc?rev=1741189&view=rev
Log:
Tell site-dev about problems

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=1741189&r1=1741188&r2=1741189&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/parseprojects.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/parseprojects.py Wed Apr 27 09:51:54 2016
@@ -9,6 +9,7 @@ import json
 import os
 from os.path import join
 import traceback
+import sendmail
 
 """
 
@@ -52,6 +53,14 @@ siteMap = {
     'ws':'webservices'
 }
 
+# Print to log and send an email (intended for WARN messages)
+def printMail(msg, file=sys.stdout):
+    print(msg, file=file)
+    try:
+        sendmail.sendMail(msg)
+    except ConnectionRefusedError:
+        print("*** Failed to send the email")
+
 def site2committee(s):
     if s in siteMap:
         return siteMap[s]
@@ -95,7 +104,7 @@ def getPMC(url):
     md.unlink()
     if t == 'asfext:pmc':
         return a
-    print("WARN: could not find asfext:pmc in %s " % url)
+    printMail("WARN: could not find asfext:pmc in %s " % url)
     return 'Unknown'
 
 def handleChild(el):
@@ -160,11 +169,11 @@ for s in itemlist :
             if m:
                 siteId = site2committee(m.group(1))
         else:
-            print("WARN: no homepage defined in %s, pmc = %s" % (url, pjson['pmc']))
+            printMail("WARN: no homepage defined in %s, pmc = %s" % (url, pjson['pmc']))
 
         pmc = 'Unknown'
         if not 'pmc' in pjson:
-            print("WARN: no asfext:pmc in %s" % url)
+            printMail("WARN: no asfext:pmc in %s" % url)
         else:
             pmcrdf = pjson['pmc']
             pmcrdf = pmcrdf.replace('/anakia', '').replace('/texen', '') # temporary hack
@@ -179,7 +188,7 @@ for s in itemlist :
         if pjson['name']:
             projectJsonFilename = name2fileName(pjson['name'], pmc)
         else:
-            print("WARN: no name defined in %s, pmc = %s" % (url, pjson['pmc']))
+            printMail("WARN: no name defined in %s, pmc = %s" % (url, pjson['pmc']))
 
         if 'pmc' in pjson and pjson['pmc'].startswith('http://attic.apache.org'):
             committeeId = 'attic'
@@ -188,7 +197,7 @@ for s in itemlist :
         else:
             committeeId = siteId
         if committeeId in retired:
-            print("WARN: project from a retired committee but PMC not changed to Attic in
%s" % url)
+            printMail("WARN: project from a retired committee but PMC not changed to Attic
in %s" % url)
             committeeId = 'attic'
         pjson['pmc'] = committeeId
 
@@ -196,10 +205,10 @@ for s in itemlist :
         if 'category' in pjson:
             pjson['category'] = pjson['category'].replace("http://projects.apache.org/category/",
"")
             if committeeId == 'attic' and not 'retired' in pjson['category']:
-                print("WARN: project in Attic but not in 'retired' category: %s" % url)
+                printMail("WARN: project in Attic but not in 'retired' category: %s" % url)
                 pjson['category'] = "%s, retired" % pjson['category']
         elif committeeId == 'attic' and not 'retired' in pjson['category']:
-            print("WARN: project in Attic but not in 'retired' category: %s" % url)
+            printMail("WARN: project in Attic but not in 'retired' category: %s" % url)
             pjson['category'] = "retired"
         if projectJsonFilename:
             #add = {}
@@ -219,9 +228,9 @@ for s in itemlist :
                 json.dump(pjson, f, sort_keys=True, indent=0, ensure_ascii=False)
                 f.close()
         else:
-            print("WARN: project ignored since unable to extract project json filename from
%s" % url)
+            printMail("WARN: project ignored since unable to extract project json filename
from %s" % url)
     except Exception as err:
-        print("Error when reading doap file %s:" % url, file=sys.stderr)
+        printMail("Error when reading doap file %s:" % url, file=sys.stderr)
         print("-"*60, file=sys.stderr)
         traceback.print_exc()
         print("-"*60, file=sys.stderr)



Mime
View raw message