[sysadmin-bin] Revert "Drop main() exception handler for testing"



commit 6f4ef01c65f55349a701401cc714e1d490398d05
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Oct 29 09:59:48 2019 +0100

    Revert "Drop main() exception handler for testing"
    
    This reverts commit 3dc127d3ae77232edebd53884e6e0fc77225748e.

 git/post-receive-mirror-github | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index 64474dd..49790cf 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -207,8 +207,11 @@ def run_command(command):
 Error trying to run command
 
 {}
+
+stdout: {}
+stderr: {}
 """
-        raise Exception(error_msg.format(command))
+        raise Exception(error_msg.format(command, out.read(), err.read()))
 
 
 def main():
@@ -253,4 +256,14 @@ def main():
 
 
 if __name__ == "__main__":
-    main()
+    try:
+        main()
+    except Exception as e:
+        msg = MIMEText(str(e))
+        msg['Subject'] = "[GITHUB HOOK] ERROR trying to push %s" %  os.getcwd()
+        msg['From']    = "noreply gnome org"
+        msg['To']      = "gnome-sysadmin gnome org"
+        msg['X-GNOME-SERVICE'] = "github-mirror"
+        server = smtplib.SMTP("localhost")
+        server.sendmail(msg['From'], msg['To'], msg.as_string())
+        server.quit()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]