[CalendarServer-changes] [12678] CalendarServer/trunk/txdav/base/datastore/subpostgres.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:21:07 PDT 2014


Revision: 12678
          http://trac.calendarserver.org//changeset/12678
Author:   cdaboo at apple.com
Date:     2014-02-12 12:07:47 -0800 (Wed, 12 Feb 2014)
Log Message:
-----------
Fix issue with socketdir and built-in postgres defaulting to a bad location.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/base/datastore/subpostgres.py

Modified: CalendarServer/trunk/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/subpostgres.py	2014-02-12 19:27:00 UTC (rev 12677)
+++ CalendarServer/trunk/txdav/base/datastore/subpostgres.py	2014-02-12 20:07:47 UTC (rev 12678)
@@ -218,21 +218,24 @@
         # Make logFile absolute in case the working directory of postgres is
         # elsewhere:
         self.logFile = os.path.abspath(logFile)
+
+        # Always use our own configured socket dir in case the built-in postgres tries to use
+        # a directory we don't have permissions for
+        if not socketDir:
+            # Socket directory was not specified, so come up with one
+            # in /tmp and based on a hash of the data store directory
+            digest = md5(dataStoreDirectory.path).hexdigest()
+            socketDir = "/tmp/ccs_postgres_" + digest
+        self.socketDir = CachingFilePath(socketDir)
+
         if listenAddresses:
-            self.socketDir = None
             self.host, self.port = listenAddresses[0].split(":") if ":" in listenAddresses[0] else (listenAddresses[0], None,)
             self.listenAddresses = [addr.split(":")[0] for addr in listenAddresses]
         else:
-            if not socketDir:
-                # Socket directory was not specified, so come up with one
-                # in /tmp and based on a hash of the data store directory
-                digest = md5(dataStoreDirectory.path).hexdigest()
-                socketDir = "/tmp/ccs_postgres_" + digest
-
-            self.socketDir = CachingFilePath(socketDir)
             self.host = self.socketDir.path
             self.port = None
             self.listenAddresses = []
+
         self.sharedBuffers = sharedBuffers if not testMode else 16
         self.maxConnections = maxConnections if not testMode else 4
         self.options = options
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/b7f0c5ab/attachment.html>


More information about the calendarserver-changes mailing list