Commit 6d491ddb authored by Tim Peters's avatar Tim Peters

Merge rev 30437 from 3.4 branch.

Use ZConfig's new socket address types appropriately.

These config file keys changed:

section    key              was             is
-------    ---------------  --------------  -------------------------
zeo        address          socket-address  socket-binding-address
zeo        monitor-address  socket-address  socket-binding-address
zeoclient  server           socket-address  socket-connection-address
parent b8c66d7b
...@@ -97,6 +97,16 @@ ZEO ...@@ -97,6 +97,16 @@ ZEO
no longer fails. If interested, see the README file for details about no longer fails. If interested, see the README file for details about
earlier version numbering schemes. earlier version numbering schemes.
- (3.4b1) ZConfig version 2.3 adds new socket address types, for smoother
default behavior across platforms. The hostname portion of
socket-binding-address defaults to an empty string, which acts like
INADDR_ANY on Windows and Linux (bind to any interface). The hostname
portion of socket-connection-address defaults to "127.0.0.1" (aka
"localhost"). In config files, the types of ``zeo`` section keys
``address`` and ``monitor-address`` changed to socket-binding-address,
and the type of the ``zeoclient`` section key ``server`` changed to
socket-connection-address.
- (3.4a4) The default logging setup in ``runzeo.py`` was broken. It was - (3.4a4) The default logging setup in ``runzeo.py`` was broken. It was
changed so that running ``runzeo.py`` from a command line now, and without changed so that running ``runzeo.py`` from a command line now, and without
using a config file, prints output to the console much as ZODB 3.2 did. using a config file, prints output to the console much as ZODB 3.2 did.
...@@ -142,6 +152,11 @@ FileStorage ...@@ -142,6 +152,11 @@ FileStorage
- (3.4a2) A ``pdb.set_trace()`` call was mistakenly left in method - (3.4a2) A ``pdb.set_trace()`` call was mistakenly left in method
``FileStorage.modifiedInVersion()``. ``FileStorage.modifiedInVersion()``.
ZConfig
-------
- (3.4b1) The "standalone" release of ZODB now includes ZConfig version 2.3.
DemoStorage DemoStorage
----------- -----------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
of a ZEO server except for the storage(s) to be served. of a ZEO server except for the storage(s) to be served.
</description> </description>
<key name="address" datatype="socket-address" <key name="address" datatype="socket-binding-address"
required="yes"> required="yes">
<description> <description>
The address at which the server should listen. This can be in The address at which the server should listen. This can be in
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</description> </description>
</key> </key>
<key name="monitor-address" datatype="socket-address" <key name="monitor-address" datatype="socket-binding-address"
required="no"> required="no">
<description> <description>
The address at which the monitor server should listen. If The address at which the monitor server should listen. If
......
...@@ -53,9 +53,9 @@ def log(msg, level=logging.INFO, exc_info=False): ...@@ -53,9 +53,9 @@ def log(msg, level=logging.INFO, exc_info=False):
message = "(%s) %s" % (_pid, msg) message = "(%s) %s" % (_pid, msg)
logger.log(level, message, exc_info=exc_info) logger.log(level, message, exc_info=exc_info)
def parse_address(arg): def parse_binding_address(arg):
# Caution: Not part of the official ZConfig API. # Caution: Not part of the official ZConfig API.
obj = ZConfig.datatypes.SocketAddress(arg) obj = ZConfig.datatypes.SocketBindingAddress(arg)
return obj.family, obj.address return obj.family, obj.address
def windows_shutdown_handler(): def windows_shutdown_handler():
...@@ -68,10 +68,10 @@ class ZEOOptionsMixin: ...@@ -68,10 +68,10 @@ class ZEOOptionsMixin:
storages = None storages = None
def handle_address(self, arg): def handle_address(self, arg):
self.family, self.address = parse_address(arg) self.family, self.address = parse_binding_address(arg)
def handle_monitor_address(self, arg): def handle_monitor_address(self, arg):
self.monitor_family, self.monitor_address = parse_address(arg) self.monitor_family, self.monitor_address = parse_binding_address(arg)
def handle_filename(self, arg): def handle_filename(self, arg):
from ZODB.config import FileStorage # That's a FileStorage *opener*! from ZODB.config import FileStorage # That's a FileStorage *opener*!
......
...@@ -24,11 +24,9 @@ import ZODB.config ...@@ -24,11 +24,9 @@ import ZODB.config
from ZEO.runzeo import ZEOOptions from ZEO.runzeo import ZEOOptions
from zdaemon.tests.testzdoptions import TestZDOptions from zdaemon.tests.testzdoptions import TestZDOptions
# When a hostname isn't specified in an address, ZConfig supplies a # When a hostname isn't specified in a socket binding address, ZConfig
# platform-dependent default value. # supplies the empty string.
DEFAULT_HOSTNAME = '' DEFAULT_BINDING_HOST = ""
if sys.platform in ['win32',]:
DEFAULT_HOSTNAME = 'localhost'
class TestZEOOptions(TestZDOptions): class TestZEOOptions(TestZDOptions):
...@@ -66,7 +64,7 @@ class TestZEOOptions(TestZDOptions): ...@@ -66,7 +64,7 @@ class TestZEOOptions(TestZDOptions):
def test_defaults_with_schema(self): def test_defaults_with_schema(self):
options = self.OptionsClass() options = self.OptionsClass()
options.realize(["-C", self.tempfilename]) options.realize(["-C", self.tempfilename])
self.assertEqual(options.address, (DEFAULT_HOSTNAME, 5555)) self.assertEqual(options.address, (DEFAULT_BINDING_HOST, 5555))
self.assertEqual(len(options.storages), 1) self.assertEqual(len(options.storages), 1)
opener = options.storages[0] opener = options.storages[0]
self.assertEqual(opener.name, "fs") self.assertEqual(opener.name, "fs")
...@@ -78,7 +76,7 @@ class TestZEOOptions(TestZDOptions): ...@@ -78,7 +76,7 @@ class TestZEOOptions(TestZDOptions):
def test_defaults_without_schema(self): def test_defaults_without_schema(self):
options = self.OptionsClass() options = self.OptionsClass()
options.realize(["-a", "5555", "-f", "Data.fs"]) options.realize(["-a", "5555", "-f", "Data.fs"])
self.assertEqual(options.address, (DEFAULT_HOSTNAME, 5555)) self.assertEqual(options.address, (DEFAULT_BINDING_HOST, 5555))
self.assertEqual(len(options.storages), 1) self.assertEqual(len(options.storages), 1)
opener = options.storages[0] opener = options.storages[0]
self.assertEqual(opener.name, "1") self.assertEqual(opener.name, "1")
...@@ -92,7 +90,7 @@ class TestZEOOptions(TestZDOptions): ...@@ -92,7 +90,7 @@ class TestZEOOptions(TestZDOptions):
options = self.OptionsClass() options = self.OptionsClass()
options.realize(["-C", self.tempfilename, options.realize(["-C", self.tempfilename,
"-a", "6666", "-f", "Wisdom.fs"]) "-a", "6666", "-f", "Wisdom.fs"])
self.assertEqual(options.address, (DEFAULT_HOSTNAME, 6666)) self.assertEqual(options.address, (DEFAULT_BINDING_HOST, 6666))
self.assertEqual(len(options.storages), 1) self.assertEqual(len(options.storages), 1)
opener = options.storages[0] opener = options.storages[0]
self.assertEqual(opener.__class__, ZODB.config.FileStorage) self.assertEqual(opener.__class__, ZODB.config.FileStorage)
......
...@@ -136,7 +136,7 @@ class ZEOClient(BaseConfig): ...@@ -136,7 +136,7 @@ class ZEOClient(BaseConfig):
def open(self): def open(self):
from ZEO.ClientStorage import ClientStorage from ZEO.ClientStorage import ClientStorage
# config.server is a multikey of socket-address values # config.server is a multikey of socket-connection-address values
# where the value is a socket family, address tuple. # where the value is a socket family, address tuple.
L = [server.address for server in self.config.server] L = [server.address for server in self.config.server]
return ClientStorage( return ClientStorage(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment