Commit ee15798b authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #91 from zopefoundation/issue90

runzeo clears socket files no matter what type of string address is
parents a4af74b4 d820dcea
...@@ -5,7 +5,7 @@ matrix: ...@@ -5,7 +5,7 @@ matrix:
- os: linux - os: linux
python: 2.7 python: 2.7
- os: linux - os: linux
python: pypy-5.4.1 python: pypy-5.6.0
- os: linux - os: linux
python: 3.4 python: 3.4
- os: linux - os: linux
......
...@@ -8,6 +8,8 @@ Changelog ...@@ -8,6 +8,8 @@ Changelog
new-style on Python 3). This improves performance on PyPy. See new-style on Python 3). This improves performance on PyPy. See
`issue 86 <<https://github.com/zopefoundation/ZEO/pull/86>`_. `issue 86 <<https://github.com/zopefoundation/ZEO/pull/86>`_.
- Fixed removing UNIX socket files under Python 2 with ZConfig 3.2.0.
See `issue 90 <https://github.com/zopefoundation/ZEO/issues/90>`_.
5.1.0 (2017-04-03) 5.1.0 (2017-04-03)
------------------ ------------------
......
...@@ -190,10 +190,10 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage): ...@@ -190,10 +190,10 @@ class ClientStorage(ZODB.ConflictResolution.ConflictResolvingStorage):
self.__name__ = name or str(addr) # Standard convention for storages self.__name__ = name or str(addr) # Standard convention for storages
if isinstance(addr, str): if isinstance(addr, six.string_types):
addr = [addr] addr = [addr]
elif (isinstance(addr, tuple) and len(addr) == 2 and elif (isinstance(addr, tuple) and len(addr) == 2 and
isinstance(addr[0], str) and isinstance(addr[1], int)): isinstance(addr[0], six.string_types) and isinstance(addr[1], int)):
addr = [addr] addr = [addr]
logger.info( logger.info(
......
...@@ -29,19 +29,17 @@ Options: ...@@ -29,19 +29,17 @@ Options:
Unless -C is specified, -a and -f are required. Unless -C is specified, -a and -f are required.
""" """
from __future__ import print_function from __future__ import print_function
from __future__ import print_function
# The code here is designed to be reused by other, similar servers. # The code here is designed to be reused by other, similar servers.
# For the forseeable future, it must work under Python 2.1 as well as
# 2.2 and above.
import asyncore
import os import os
import sys import sys
import signal import signal
import socket import socket
import logging import logging
import six
import ZConfig.datatypes import ZConfig.datatypes
from zdaemon.zdoptions import ZDOptions from zdaemon.zdoptions import ZDOptions
...@@ -193,7 +191,7 @@ class ZEOServer(object): ...@@ -193,7 +191,7 @@ class ZEOServer(object):
return 1 return 1
def clear_socket(self): def clear_socket(self):
if isinstance(self.options.address, type("")): if isinstance(self.options.address, six.string_types):
try: try:
os.unlink(self.options.address) os.unlink(self.options.address)
except os.error: except os.error:
...@@ -275,7 +273,7 @@ class ZEOServer(object): ...@@ -275,7 +273,7 @@ class ZEOServer(object):
def handle_sigusr2(self): def handle_sigusr2(self):
# log rotation signal - do the same as Zope 2.7/2.8... # log rotation signal - do the same as Zope 2.7/2.8...
if self.options.config_logger is None or os.name not in ("posix", "nt"): if self.options.config_logger is None or os.name not in ("posix", "nt"):
log("received SIGUSR2, but it was not handled!", log("received SIGUSR2, but it was not handled!",
level=logging.WARNING) level=logging.WARNING)
return return
......
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIID/TCCAuWgAwIBAgIJAJWOSC4oLyp9MA0GCSqGSIb3DQEBBQUAMFwxCzAJBgNV MIIDCDCCAfACCQCbN0hYgirJXTANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJB
BAYTAlVTMQswCQYDVQQIEwJWQTENMAsGA1UEChMEWk9EQjERMA8GA1UEAxMIem9k VTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0
Yi5vcmcxHjAcBgkqhkiG9w0BCQEWD2NsaWVudEB6b2RiLm9yZzAeFw0xNjA2MjMx cyBQdHkgTHRkMCAXDTE3MDcxMTEzNTM0OFoYDzQ3NTUwNjA3MTM1MzQ4WjBFMQsw
NTA3MTNaFw0xNzA2MjMxNTA3MTNaMFwxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJW CQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UEC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LNyvGEzyFC
vsooEoIE9c+b1c1TOHBsiseAOx+nqhgPP2yUDl75Oqkzs4bJXGGUS+N8o43b3E8I H37PbM6Am7LfYZuqW6w1LClQLfVfmJfGROZvib65QqWTlvj+fbsdyniuhIJ5Z1Tf
WRPQcXIijqtlyhtA6w/h5cECgYEA2M6DnGXQKZrTYr1rRc+xkGTpj9607P5XGS9p BH+kyiEvxyHjdDLRJ9vfsKECgYA8P9MFt7sMAxWpHaS+NUQVyk8fTwHY25oZptRJ
8dsK74zd+VdyLYdOiuBTVrYfB2ZneJM3fqsHPLcxL3SnT6TCarySaOXVXremoo/G t2fxg49mJ90C+GaHn75HKqKhSb1oHNq1oPUqmEreC0AGE/fGAMSd2SZ5Y83VW9eZ
xRgBCNY4w61VNe4JalMcKcJg6r12W3wdMCnCHNkRqFdu29qRKnLSd14DXBFrjY+W JhzzQtAXBsQqrJO9GQyJGOnnSrsRAIM800nRLrS/ozupwM4EVb7UeQcaDF2vsVEI
vpMMjuECgYEAtNOm9WTCAlVbGTMplXcUJBWNwdOz+sHMi+PhP/fTNm0XH3fepFeQ jQS/oQKBgHj26xn7AunX5GS8EYe4GPj4VZehmlnEKONGrPrr25aWkaY4kDJgMLUb
th7b/RYocTwAHGu8mArX2DgXAfDQAYMPFN8vmbh0XQsQV+iuja9MO2TagTyVSe3x AxwIQHbCMm5TMqIxi5l39/O9dxuuGCkOs37j7C3f3VVFuQW1KKyHem9OClgFDZj3
DBOTFCLg8oWtzwySZ6BKR/KsGI2ryRxyE1VojV0zNXRyZqDCm+G4Vs0= tEEk1N3NevrH06NlmAHweHMuJXL8mBvM375zH9tSw5mgG0OMRbnG
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
...@@ -53,7 +53,7 @@ class ZEOConfig(object): ...@@ -53,7 +53,7 @@ class ZEOConfig(object):
else: else:
self.logpath = 'server.log' self.logpath = 'server.log'
if not isinstance(addr, str): if not isinstance(addr, six.string_types):
addr = '%s:%s' % addr addr = '%s:%s' %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AXBsQqrJO9GQyJGOnnSrsRAIM800nRLrS/ozupwM4EVb7UeQcaDF2vsVEI
XfuDgQKBgQCYW+x52XSaTjE0SviYmeNuO30bELgjxPyPLge407EAp1h6Sr9Za5ap jQS/oQKBgHj26xn7AunX5GS8EYe4GPj4VZehmlnEKONGrPrr25aWkaY4kDJgMLUb
2aQsClsuzpHcHDoWmzO+dTr70Qyt/YoY5FN3uZRG9m7X/OH7+ceBEU/BtQ0Whem4 AxwIQHbCMm5TMqIxi5l39/O9dxuuGCkOs37j7C3f3VVFuQW1KKyHem9OClgFDZj3
YNE5lpuw4eGsJQGkhRFcqKy66gId7Sw5b6CIaJqbhQCogkWt5JQuWQ== tEEk1N3NevrH06NlmAHweHMuJXL8mBvM375zH9tSw5mgG0OMRbnG
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
#
# Fix AttributeError: 'ZEOServer' object has no attribute 'server' in
# ZEOServer.main
#
import unittest import unittest
import mock
import os
from ZEO._compat import PY3
from ZEO.runzeo import ZEOServer from ZEO.runzeo import ZEOServer
...@@ -55,9 +55,6 @@ class TestZEOServer(ZEOServer): ...@@ -55,9 +55,6 @@ class TestZEOServer(ZEOServer):
self.called.append("close_server") self.called.append("close_server")
ZEOServer.close_server(self) ZEOServer.close_server(self)
def clear_socket(self):
self.called.append("clear_socket")
def remove_pidfile(self): def remove_pidfile(self):
self.called.append("remove_pidfile") self.called.append("remove_pidfile")
...@@ -65,6 +62,10 @@ class TestZEOServer(ZEOServer): ...@@ -65,6 +62,10 @@ class TestZEOServer(ZEOServer):
class AttributeErrorTests(unittest.TestCase): class AttributeErrorTests(unittest.TestCase):
def testFailCreateServer(self): def testFailCreateServer(self):
#
# Fix AttributeError: 'ZEOServer' object has no attribute
# 'server' in ZEOServer.main
#
# Demonstrate the AttributeError # Demonstrate the AttributeError
zeo = TestZEOServer(fail_create_server=True) zeo = TestZEOServer(fail_create_server=True)
self.assertRaises(RuntimeError, zeo.main) self.assertRaises(RuntimeError, zeo.main)
...@@ -137,9 +138,42 @@ class CloseServerTests(unittest.TestCase): ...@@ -137,9 +138,42 @@ class CloseServerTests(unittest.TestCase):
self.assertEqual(hasattr(zeo, "server"), True) self.assertEqual(hasattr(zeo, "server"), True)
self.assertEqual(zeo.server, None) self.assertEqual(zeo.server, None)
@mock.patch('os.unlink')
def test_suite(): class TestZEOServerSocket(unittest.TestCase):
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(AttributeErrorTests)) def _unlinked(self, unlink, options):
suite.addTest(unittest.makeSuite(CloseServerTests)) server = ZEOServer(options)
return suite server.clear_socket()
unlink.assert_called_once()
def _not_unlinked(self, unlink, options):
server = ZEOServer(options)
server.clear_socket()
unlink.assert_not_called()
def test_clear_with_native_str(self, unlink):
class Options(object):
address = "a str that does not exist"
self._unlinked(unlink, Options)
def test_clear_with_unicode_str(self, unlink):
class Options(object):
address = u"a str that does not exist"
self._unlinked(unlink, Options)
def test_clear_with_bytes(self, unlink):
class Options(object):
address = b'a byte str that does not exist'
if PY3:
# bytes are not a string type under Py3
assertion = self._not_unlinked
else:
assertion = self._unlinked
assertion(unlink, Options)
def test_clear_with_tuple(self, unlink):
class Options(object):
address = ('abc', 1)
self._not_unlinked(unlink, Options)
...@@ -369,6 +369,12 @@ def client_ssl(cafile=server_key, ...@@ -369,6 +369,12 @@ def client_ssl(cafile=server_key,
context.check_hostname = False context.check_hostname = False
return context return context
# Here's a command to create a cert/key pair: # See
# openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \ # https://discuss.pivotal.io/hc/en-us/articles/202653388-How-to-renew-an-expired-Apache-Web-Server-self-signed-certificate-using-the-OpenSSL-tool
# -days 999999 -nodes -batch # for instructions on updating the server.pem (the certificate) if
# needed. server.pem.csr is the request.
# This should do it:
# openssl x509 -req -days 999999 -in src/ZEO/tests/server.pem.csr -signkey src/ZEO/tests/server_key.pem -out src/ZEO/tests/server.pem
# If you need to create a new key first:
# openssl genrsa -out server_key.pem 2048
# These two files should then be copied to client_key.pem and client.pem.
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