diff --git a/letsencrypt/configuration.py b/letsencrypt/configuration.py index a2eab5ecb73..f72005233f1 100644 --- a/letsencrypt/configuration.py +++ b/letsencrypt/configuration.py @@ -7,6 +7,7 @@ from acme import challenges from letsencrypt import constants +from letsencrypt import errors from letsencrypt import interfaces @@ -36,11 +37,10 @@ class NamespaceConfig(object): def __init__(self, namespace): self.namespace = namespace - # XXX: breaks renewer in some bizarre way - #if self.simple_http_port == self.dvsni_port: - # raise errors.Error( - # "Trying to run SimpleHTTP non-TLS and DVSNI " - # "on the same port ({0})".format(self.dvsni_port)) + if self.simple_http_port == self.dvsni_port: + raise errors.Error( + "Trying to run SimpleHTTP and DVSNI " + "on the same port ({0})".format(self.dvsni_port)) def __getattr__(self, name): return getattr(self.namespace, name) diff --git a/letsencrypt/tests/configuration_test.py b/letsencrypt/tests/configuration_test.py index c1eba85703d..44bccb57754 100644 --- a/letsencrypt/tests/configuration_test.py +++ b/letsencrypt/tests/configuration_test.py @@ -4,6 +4,8 @@ import mock +from letsencrypt import errors + class NamespaceConfigTest(unittest.TestCase): """Tests for letsencrypt.configuration.NamespaceConfig.""" @@ -12,10 +14,15 @@ def setUp(self): self.namespace = mock.MagicMock( config_dir='/tmp/config', work_dir='/tmp/foo', foo='bar', server='https://acme-server.org:443/new', - dvsni_port='1234', simple_http_port=4321) + dvsni_port=1234, simple_http_port=4321) from letsencrypt.configuration import NamespaceConfig self.config = NamespaceConfig(self.namespace) + def test_init_same_ports(self): + self.namespace.dvsni_port = 4321 + from letsencrypt.configuration import NamespaceConfig + self.assertRaises(errors.Error, NamespaceConfig, self.namespace) + def test_proxy_getattr(self): self.assertEqual(self.config.foo, 'bar') self.assertEqual(self.config.work_dir, '/tmp/foo')