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

[tor-commits] [bridgedb/master] Add review feedback



commit 85b4a9cfe41308458b29356b1d771b192b4a7681
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Wed Dec 11 17:31:17 2019 +0100

    Add review feedback
---
 scripts/check_status | 91 ++++++++++++++++++++++++++--------------------------
 1 file changed, 45 insertions(+), 46 deletions(-)

diff --git a/scripts/check_status b/scripts/check_status
index 8f8f3e5..5032e33 100644
--- a/scripts/check_status
+++ b/scripts/check_status
@@ -82,7 +82,6 @@ def send_email_from_gmail(password):
 
     try:
         mail = smtplib.SMTP_SSL('smtp.gmail.com', 465)
-        mail.ehlo()
         mail.login(sent_from, password)
         mail.sendmail(sent_from, sent_to, email_text)
         mail.close()
@@ -90,48 +89,48 @@ def send_email_from_gmail(password):
     except Exception as e:
         return UNKNOWN, str(e)
 
-        if __name__ == "__main__":
-            status, message = None, None
-
-            if len(sys.argv) == 2:
-                password = sys.argv[1]
-            else:
-                password = "yourPassword"
-
-            status_file = open(STATUS_FILE, 'r')
-            message = status_file.read()
-            status_file.close()
-
-            try:
-                status, message = send_email_from_gmail(password)
-            except Exception as e:
-                status = UNKNOWN
-                message = repr(e)
-                status_file = open(STATUS_FILE,'w')
-                status_file.write("UNKNOWN\n3: %s" % message)
-                status_file.close()
-
-            time.sleep(600)
-
-            try:
-                status, message = test_email_from_gmail(password)
-            except KeyboardInterrupt:
-                status, message = CRITICAL, "Caught Control-C..."
-            except Exception as e:
-                status = CRITICAL
-                message = repr(e)
-            finally:
-                status_file = open(STATUS_FILE,'w')
-                if status == OK:
-                    status_file.write("OK\n0: %s" % message)
-                elif status == WARNING:
-                    status_file.write("WARNING\n1: %s" % message)
-                elif status == CRITICAL:
-                    status_file.write("CRITICAL\n2: %s" % message)
-                else:
-                    status_file.write("UNKNOWN\n3: %s" % message)
-                    status = UNKNOWN
-
-                status_file.close()
-
-                sys.exit(status)
+if __name__ == "__main__":
+    status, message = None, None
+
+    if len(sys.argv) == 2:
+        password = sys.argv[1]
+    else:
+        password = "yourPassword"
+
+    status_file = open(STATUS_FILE, 'r')
+    message = status_file.read()
+    status_file.close()
+
+    try:
+        status, message = send_email_from_gmail(password)
+    except Exception as e:
+        status = UNKNOWN
+        message = repr(e)
+        status_file = open(STATUS_FILE,'w')
+        status_file.write("UNKNOWN\n3: %s" % message)
+        status_file.close()
+
+    time.sleep(600)
+
+    try:
+        status, message = test_email_from_gmail(password)
+    except KeyboardInterrupt:
+        status, message = CRITICAL, "Caught Control-C..."
+    except Exception as e:
+        status = CRITICAL
+        message = repr(e)
+    finally:
+        status_file = open(STATUS_FILE,'w')
+        if status == OK:
+            status_file.write("OK\n0: %s" % message)
+        elif status == WARNING:
+            status_file.write("WARNING\n1: %s" % message)
+        elif status == CRITICAL:
+            status_file.write("CRITICAL\n2: %s" % message)
+        else:
+            status_file.write("UNKNOWN\n3: %s" % message)
+            status = UNKNOWN
+
+        status_file.close()
+
+        sys.exit(status)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits