community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1741014 - in /comdev/projects.apache.org/scripts/cronjobs: parsecommitteeinfo.py sendmail.py
Date Tue, 26 Apr 2016 13:13:02 GMT
Author: sebb
Date: Tue Apr 26 13:13:01 2016
New Revision: 1741014

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

Modified:
    comdev/projects.apache.org/scripts/cronjobs/parsecommitteeinfo.py
    comdev/projects.apache.org/scripts/cronjobs/sendmail.py

Modified: comdev/projects.apache.org/scripts/cronjobs/parsecommitteeinfo.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/parsecommitteeinfo.py?rev=1741014&r1=1741013&r2=1741014&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/parsecommitteeinfo.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/parsecommitteeinfo.py Tue Apr 26 13:13:01
2016
@@ -11,6 +11,7 @@ import urllib.request
 import xml.etree.ElementTree as ET
 import xml.dom.minidom as minidom
 import datetime
+import sendmail
 
 sys.path.append("..") # module committee_info is in parent directory
 import committee_info
@@ -38,6 +39,14 @@ homepages = {
     'whimsy': 'http://whimsical.apache.org/', # incorrect in index.html because actual site
does not yet exist
 }
 
+# Print to log and send an email (intended for WARN messages)
+def printMail(msg):
+    print(msg)
+    try:
+        sendmail.sendMail(msg)
+    except ConnectionRefusedError:
+        print("*** Failed to send the email")
+
 # compress a string: trim it and replace multiple whitespace with a single space
 def compress(s):
     return re.sub(r"""\s+""", ' ', s.strip())
@@ -184,12 +193,12 @@ for group in sorted(committees, key=keyo
             if ctte['description']:
                 committee['shortdesc'] = ctte['description']
             else:
-                print("WARN: %s (%s) missing from http://www.apache.org/#projects-list" %
(group, fullName))
+                printMail("WARN: %s (%s) missing from http://www.apache.org/index.html#projects-list"
% (group, fullName))
 
             if committeeId in pmcDataUrls:
                 committee['rdf'] = pmcDataUrls[committeeId]
             else:
-                print("WARN: %s (%s) missing from /data/committees.xml" % (fullName, committeeId))
+                printMail("WARN: %s (%s) missing from /data/committees.xml" % (fullName,
committeeId))
                 if os.path.isfile("../../data/committees/%s.rdf" % committeeId):
                     print("INFO: %s.rdf exists in data/committees/ but is not in /data/committees.xml"
% committeeId)
 

Modified: comdev/projects.apache.org/scripts/cronjobs/sendmail.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/sendmail.py?rev=1741014&r1=1741013&r2=1741014&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/sendmail.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/sendmail.py Tue Apr 26 13:13:01 2016
@@ -4,7 +4,7 @@ import smtplib
 # Import the email modules we'll need
 from email.mime.text import MIMEText
 
-def sendMail(subject, body, recipients, sender='no-reply@projects.apache.org', port=25):
+def sendMail(subject, body='', recipients='Site Development <site-dev@apache.org>',
sender='no-reply@projects.apache.org', port=25):
     # Create a text/plain message
     msg = MIMEText(body)
     msg['Subject'] = subject
@@ -17,7 +17,7 @@ def sendMail(subject, body, recipients,
 if __name__ == '__main__':
     # for testing locally:
     # sudo postfix start # MacoxX
-    # or start a debug server => need to change the SMTP port above
+    # or start a debug server => need to change the SMTP port
     # python -m smtpd -n -c DebuggingServer localhost:1025
     sendMail('Example SMTP message', "The quick brown fox ...", 'no-one')
     print("Sent")
\ No newline at end of file



Mime
View raw message