Commit 453f2028 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 5268910d
......@@ -97,6 +97,16 @@ ZEO
no longer fails. If interested, see the README file for details about
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
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.
......@@ -142,6 +152,11 @@ FileStorage
- (3.4a2) A ``pdb.set_trace()`` call was mistakenly left in method
``FileStorage.modifiedInVersion()``.
ZConfig
-------
- (3.4b1) The "standalone" release of ZODB now includes ZConfig version 2.3.
DemoStorage
-----------
......
......@@ -7,7 +7,7 @@
of a ZEO server except for the storage(s) to be served.
</description>
<key name="address" datatype="socket-address"
<key name="address" datatype="socket-binding-address"
required="yes">
<description>
The address at which the server should listen. This can be in
......@@ -45,7 +45,7 @@
</description>
</key>
<key name="monitor-address" datatype="socket-address"
<key name="monitor-address" datatype="socket-binding-address"
required="no">
<description>
The address at which the monitor server should listen. If
......
......@@ -53,9 +53,9 @@ def log(msg, level=logging.INFO, exc_info=False):
message = "(%s) %s" % (_pid, msg)
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.
obj = ZConfig.datatypes.SocketAddress(arg)
obj = ZConfig.datatypes.SocketBindingAddress(arg)
return obj.family, obj.address
def windows_shutdown_handler():
......@@ -68,10 +68,10 @@ class ZEOOptionsMixin:
storages = None
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):
self.monitor_family, self.monitor_address = parse_address(arg)
self.monitor_family, self.monitor_address = parse_binding_address(arg)
def handle_filename(self, arg):
from ZODB.config import FileStorage # That's a FileStorage *opener*!
......
......@@ -24,11 +24,9 @@ import ZODB.config
from ZEO.runzeo import ZEOOptions
from zdaemon.tests.testzdoptions import TestZDOptions
# When a hostname isn't specified in an address, ZConfig supplies a
# platform-dependent default value.
DEFAULT_HOSTNAME = ''
if sys.platform in ['win32',]:
DEFAULT_HOSTNAME = 'localhost'
# When a hostname isn't specified in a socket binding address, ZConfig
# supplies the empty string.
DEFAULT_BINDING_HOST = ""
class TestZEOOptions(TestZDOptions):
......@@ -66,7 +64,7 @@ class TestZEOOptions(TestZDOptions):
def test_defaults_with_schema(self):
options = self.OptionsClass()
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)
opener = options.storages[0]
self.assertEqual(opener.name, "fs")
......@@ -78,7 +76,7 @@ class TestZEOOptions(TestZDOptions):
def test_defaults_without_schema(self):
options = self.OptionsClass()
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)
opener = options.storages[0]
self.assertEqual(opener.name, "1")
......@@ -92,7 +90,7 @@ class TestZEOOptions(TestZDOptions):
options = self.OptionsClass()
options.realize(["-C", self.tempfilename,
"-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)
opener = options.storages[0]
self.assertEqual(opener.__class__, ZODB.config.FileStorage)
......
......@@ -136,7 +136,7 @@ class ZEOClient(BaseConfig):
def open(self):
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.
L = [server.address for server in self.config.server]
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