[CalendarServer-changes] [10868] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 7 15:12:53 PST 2013
Revision: 10868
http://trac.calendarserver.org//changeset/10868
Author: glyph at apple.com
Date: 2013-03-07 15:12:53 -0800 (Thu, 07 Mar 2013)
Log Message:
-----------
Configurable pg_ctl and initdb.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/util.py
CalendarServer/trunk/twistedcaldav/stdconfig.py
CalendarServer/trunk/txdav/base/datastore/subpostgres.py
Property Changed:
----------------
CalendarServer/trunk/
Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py 2013-03-07 22:42:21 UTC (rev 10867)
+++ CalendarServer/trunk/calendarserver/tap/util.py 2013-03-07 23:12:53 UTC (rev 10868)
@@ -132,7 +132,9 @@
options=config.Postgres.Options,
uid=uid, gid=gid,
spawnedDBUser=config.SpawnedDBUser,
- importFileName=config.DBImportFile
+ importFileName=config.DBImportFile,
+ pgCtl=config.Postgres.Ctl,
+ initDB=config.Postgres.Init,
)
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-03-07 22:42:21 UTC (rev 10867)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-03-07 23:12:53 UTC (rev 10868)
@@ -908,6 +908,11 @@
"Options": [
"-c standard_conforming_strings=on",
],
+ "Ctl": "pg_ctl", # Iff the DBType is '', and we're spawning postgres
+ # ourselves, where is the pg_ctl tool to spawn it with?
+ "Init": "initdb", # Iff the DBType is '', and we're spawning postgres
+ # ourselves, where is the initdb tool to create its
+ # database cluster with?
},
"QueryCaching" : {
Modified: CalendarServer/trunk/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/subpostgres.py 2013-03-07 22:42:21 UTC (rev 10867)
+++ CalendarServer/trunk/txdav/base/datastore/subpostgres.py 2013-03-07 23:12:53 UTC (rev 10868)
@@ -166,7 +166,9 @@
testMode=False,
uid=None, gid=None,
spawnedDBUser="caldav",
- importFileName=None):
+ importFileName=None,
+ pgCtl="pg_ctl",
+ initDB="initdb"):
"""
Initialize a L{PostgresService} pointed at a data store directory.
@@ -235,8 +237,21 @@
self.schema = schema
self.monitor = None
self.openConnections = []
+ self._pgCtl = pgCtl
+ self._initdb = initDB
+ def pgCtl(self):
+ """
+ Locate the path to pg_ctl.
+ """
+ return which(self._pgCtl)[0]
+
+
+ def initdb(self):
+ return which(self._initdb)[0]
+
+
def activateDelayedShutdown(self):
"""
Call this when starting database initialization code to protect against
@@ -369,7 +384,7 @@
Start the database and initialize the subservice.
"""
monitor = _PostgresMonitor(self)
- pg_ctl = which("pg_ctl")[0]
+ pgCtl = self.pgCtl()
# check consistency of initdb and postgres?
options = []
@@ -386,9 +401,9 @@
options.extend(self.options)
reactor.spawnProcess(
- monitor, pg_ctl,
+ monitor, pgCtl,
[
- pg_ctl,
+ pgCtl,
"start",
"-l", self.logFile,
"-w",
@@ -422,7 +437,7 @@
env.update(PGDATA=clusterDir.path,
PGHOST=self.host,
PGUSER=self.spawnedDBUser)
- initdb = which("initdb")[0]
+ initdb = self.initdb()
if self.socketDir:
if not self.socketDir.isdir():
self.socketDir.createDirectory()
@@ -470,9 +485,9 @@
# database. (This also happens in command-line tools.)
if self.shouldStopDatabase:
monitor = _PostgresMonitor()
- pg_ctl = which("pg_ctl")[0]
- reactor.spawnProcess(monitor, pg_ctl,
- [pg_ctl, '-l', 'logfile', 'stop'],
+ pgCtl = self.pgCtl()
+ reactor.spawnProcess(monitor, pgCtl,
+ [pgCtl, '-l', 'logfile', 'stop'],
self.env,
uid=self.uid, gid=self.gid,
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130307/961d7771/attachment.html>
More information about the calendarserver-changes
mailing list