You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2016/07/10 14:05:30 UTC

svn commit: r1752092 - /comdev/projects.apache.org/scripts/cronjobs/parseprojects.py

Author: sebb
Date: Sun Jul 10 14:05:29 2016
New Revision: 1752092

URL: http://svn.apache.org/viewvc?rev=1752092&view=rev
Log:
Redirect the mails to Attic, but once a month only

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=1752092&r1=1752091&r2=1752092&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/parseprojects.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/parseprojects.py Sun Jul 10 14:05:29 2016
@@ -61,6 +61,20 @@ def printMail(msg, file=sys.stdout):
     except ConnectionRefusedError:
         print("*** Failed to send the email", file=file)
 
+ATTIC = 'Attic <ge...@attic.apache.org>'
+# Print to log and send a conditional email to Attic
+def printAtticMail(msg, file=sys.stdout):
+    print(msg, file=file)
+    import datetime
+    # Only sent the mail once a month
+    if datetime.datetime.now().day != 11:
+        print("Not sending the email to '" + str(ATTIC) +"'" , file=file)
+        return
+    try:
+        sendmail.sendMail(msg,recipients=ATTIC, replyTo=None)
+    except ConnectionRefusedError:
+        print("*** Failed to send the email to '" + str(ATTIC) +"'" , file=file)
+
 def site2committee(s):
     if s in siteMap:
         return siteMap[s]
@@ -197,7 +211,7 @@ for s in itemlist :
         else:
             committeeId = siteId
         if committeeId in retired:
-            printMail("WARN: project from a retired committee but PMC not changed to Attic in %s" % url)
+            printAtticMail("WARN: project from a retired committee but PMC not changed to Attic in %s" % url)
             committeeId = 'attic'
         pjson['pmc'] = committeeId
 
@@ -205,10 +219,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']:
-                printMail("WARN: project in Attic but not in 'retired' category: %s" % url)
+                printAtticMail("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']:
-            printMail("WARN: project in Attic but not in 'retired' category: %s" % url)
+            printAtticMail("WARN: project in Attic but not in 'retired' category: %s" % url)
             pjson['category'] = "retired"
         if projectJsonFilename:
             #add = {}