[Zodb-checkins] SVN: ZODB/trunk/src/ Bug Fixed: The runzeo script didn't work without a configuration file.
Jim Fulton
jim at zope.com
Thu Aug 20 07:12:53 EDT 2009
Log message for revision 102999:
Bug Fixed: The runzeo script didn't work without a configuration file.
Simplified the file-storage configuration a bit. Eliminated
duplication of defaults between the Python and ZConfig interfaces.
Changed:
U ZODB/trunk/src/CHANGES.txt
U ZODB/trunk/src/ZEO/runzeo.py
U ZODB/trunk/src/ZEO/tests/testZEO.py
U ZODB/trunk/src/ZODB/component.xml
U ZODB/trunk/src/ZODB/config.py
-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt 2009-08-20 11:12:51 UTC (rev 102998)
+++ ZODB/trunk/src/CHANGES.txt 2009-08-20 11:12:53 UTC (rev 102999)
@@ -2,6 +2,14 @@
Change History
================
+3.9.0c1 (2009-08-06)
+====================
+
+Bugs Fixed
+----------
+
+- The runzeo script didn't work without a configuration file.
+
3.9.0b5 (2009-08-06)
====================
Modified: ZODB/trunk/src/ZEO/runzeo.py
===================================================================
--- ZODB/trunk/src/ZEO/runzeo.py 2009-08-20 11:12:51 UTC (rev 102998)
+++ ZODB/trunk/src/ZEO/runzeo.py 2009-08-20 11:12:53 UTC (rev 102999)
@@ -79,10 +79,7 @@
def __init__(self, name, path):
self._name = name
self.path = path
- self.create = 0
- self.read_only = 0
self.stop = None
- self.quota = None
def getSectionName(self):
return self._name
if not self.storages:
@@ -91,7 +88,12 @@
conf = FileStorage(FSConfig(name, arg))
self.storages.append(conf)
+ testing_exit_immediately = False
+ def handle_test(self, *args):
+ self.testing_exit_immediately = True
+
def add_zeo_options(self):
+ self.add(None, None, None, "test", self.handle_test)
self.add(None, None, "a:", "address=", self.handle_address)
self.add(None, None, "f:", "filename=", self.handle_filename)
self.add("family", "zeo.address.family")
@@ -249,7 +251,10 @@
self.server = create_server(self.storages, self.options)
def loop_forever(self):
- asyncore.loop()
+ if self.options.testing_exit_immediately:
+ print "testing exit immediately"
+ else:
+ asyncore.loop()
def handle_sigterm(self):
log("terminated by SIGTERM")
Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py 2009-08-20 11:12:51 UTC (rev 102998)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py 2009-08-20 11:12:53 UTC (rev 102999)
@@ -33,6 +33,7 @@
import shutil
import signal
import stat
+import sys
import tempfile
import threading
import time
@@ -1181,6 +1182,31 @@
1
"""
+def runzeo_without_configfile():
+ """
+ >>> open('runzeo', 'w').write('''
+ ... import sys
+ ... sys.path[:] = %r
+ ... import ZEO.runzeo
+ ... ZEO.runzeo.main(sys.argv[1:])
+ ... ''' % sys.path)
+
+ >>> import subprocess, re
+ >>> print re.sub('\d\d+|[:]', '', subprocess.Popen(
+ ... [sys.executable, 'runzeo', '-a./s', '-ft', '--test'],
+ ... stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ ... ).stdout.read()),
+ ------
+ --T INFO ZEO.runzeo () opening storage '1' using FileStorage
+ ------
+ --T INFO ZEO.StorageServer () StorageServer created RW with storages 1RWt
+ ------
+ --T INFO ZEO.zrpc () listening on ./s
+ ------
+ --T INFO ZEO.runzeo () closing storage '1'
+ testing exit immediately
+ """
+
slow_test_classes = [
BlobAdaptedFileStorageTests, BlobWritableCacheTests,
DemoStorageTests, FileStorageTests, MappingStorageTests,
Modified: ZODB/trunk/src/ZODB/component.xml
===================================================================
--- ZODB/trunk/src/ZODB/component.xml 2009-08-20 11:12:51 UTC (rev 102998)
+++ ZODB/trunk/src/ZODB/component.xml 2009-08-20 11:12:53 UTC (rev 102999)
@@ -23,13 +23,13 @@
use a BlobStorage to provide blob support.)
</description>
</key>
- <key name="create" datatype="boolean" default="false">
+ <key name="create" datatype="boolean">
<description>
Flag that indicates whether the storage should be truncated if
it already exists.
</description>
</key>
- <key name="read-only" datatype="boolean" default="false">
+ <key name="read-only" datatype="boolean">
<description>
If true, only reads may be executed against the storage. Note
that the "pack" operation is not considered a write operation
Modified: ZODB/trunk/src/ZODB/config.py
===================================================================
--- ZODB/trunk/src/ZODB/config.py 2009-08-20 11:12:51 UTC (rev 102998)
+++ ZODB/trunk/src/ZODB/config.py 2009-08-20 11:12:53 UTC (rev 102999)
@@ -154,20 +154,20 @@
def open(self):
from ZODB.FileStorage import FileStorage
+ config = self.config
options = {}
- if self.config.packer:
- m, name = self.config.packer.rsplit('.', 1)
+ if getattr(config, 'packer', None):
+ m, name = config.packer.rsplit('.', 1)
options['packer'] = getattr(__import__(m, {}, {}, ['*']), name)
- return FileStorage(self.config.path,
- create=self.config.create,
- read_only=self.config.read_only,
- quota=self.config.quota,
- pack_gc=self.config.pack_gc,
- pack_keep_old=self.config.pack_keep_old,
- blob_dir=self.config.blob_dir,
- **options)
+ for name in ('blob_dir', 'create', 'read_only', 'quota', 'pack_gc',
+ 'pack_keep_old'):
+ v = getattr(config, name, self)
+ if v is not self:
+ options[name] = v
+ return FileStorage(config.path, **options)
+
class BlobStorage(BaseConfig):
def open(self):
More information about the Zodb-checkins
mailing list