[CalendarServer-changes] [15223] CalendarServer/trunk/calendarserver/tap/util.py

source_changes at macosforge.org source_changes at macosforge.org
Sat Oct 24 07:45:00 PDT 2015


Revision: 15223
          http://trac.calendarserver.org//changeset/15223
Author:   cdaboo at apple.com
Date:     2015-10-24 07:45:00 -0700 (Sat, 24 Oct 2015)
Log Message:
-----------
Unit test fix.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/util.py

Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py	2015-10-23 20:39:25 UTC (rev 15222)
+++ CalendarServer/trunk/calendarserver/tap/util.py	2015-10-24 14:45:00 UTC (rev 15223)
@@ -1306,34 +1306,30 @@
             # Fall through to see if we can load the identity from the keychain
             certificate_title = "Keychain: {}".format(config.SSLKeychainIdentity)
         else:
-            message = (
-                "No Keychain Identity was set for TLS"
-            )
-            postAlert("MissingKeychainIdentityAlert", [])
-            return False, message
-
-    elif config.SSLCertificate:
-        if not os.path.exists(config.SSLCertificate):
-            message = (
-                "The configured TLS certificate ({cert}) is missing".format(
-                    cert=config.SSLCertificate
-                )
-            )
-            postAlert("MissingCertificateAlert", ["path", config.SSLCertificate])
-            return False, message
-
-        length = os.stat(config.SSLCertificate).st_size
-        if length == 0:
+            return True, "TLS disabled"
+    else:
+        if config.SSLCertificate:
+            if not os.path.exists(config.SSLCertificate):
                 message = (
-                    "The configured TLS certificate ({cert}) is empty".format(
+                    "The configured TLS certificate ({cert}) is missing".format(
                         cert=config.SSLCertificate
                     )
                 )
+                postAlert("MissingCertificateAlert", ["path", config.SSLCertificate])
                 return False, message
-        certificate_title = config.SSLCertificate
-    else:
-        return True, "TLS disabled"
 
+            length = os.stat(config.SSLCertificate).st_size
+            if length == 0:
+                    message = (
+                        "The configured TLS certificate ({cert}) is empty".format(
+                            cert=config.SSLCertificate
+                        )
+                    )
+                    return False, message
+            certificate_title = config.SSLCertificate
+        else:
+            return True, "TLS disabled"
+
     try:
         ChainingOpenSSLContextFactory(
             config.SSLPrivateKey,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151024/b0fb75ae/attachment.html>


More information about the calendarserver-changes mailing list