mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 19:52:34 +02:00
NamespaceConfig.simple_http_port.
This commit is contained in:
@@ -4,6 +4,8 @@ import urlparse
|
||||
|
||||
import zope.interface
|
||||
|
||||
from acme import challenges
|
||||
|
||||
from letsencrypt import constants
|
||||
from letsencrypt import interfaces
|
||||
|
||||
@@ -34,6 +36,13 @@ class NamespaceConfig(object):
|
||||
def __init__(self, namespace):
|
||||
self.namespace = namespace
|
||||
|
||||
# XXX: breaks renewer in some bizarre way
|
||||
#if self.no_simple_http_tls and (
|
||||
# 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))
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.namespace, name)
|
||||
|
||||
@@ -69,6 +78,15 @@ class NamespaceConfig(object):
|
||||
return os.path.join(
|
||||
self.namespace.work_dir, constants.TEMP_CHECKPOINT_DIR)
|
||||
|
||||
@property
|
||||
def simple_http_port(self): # pylint: disable=missing-docstring
|
||||
if self.namespace.simple_http_port is not None:
|
||||
return self.namespace.simple_http_port
|
||||
if self.no_simple_http_tls:
|
||||
return challenges.SimpleHTTPResponse.PORT
|
||||
else:
|
||||
return challenges.SimpleHTTPResponse.TLS_PORT
|
||||
|
||||
|
||||
class RenewerConfiguration(object):
|
||||
"""Configuration wrapper for renewer."""
|
||||
|
||||
@@ -11,7 +11,8 @@ class NamespaceConfigTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.namespace = mock.MagicMock(
|
||||
config_dir='/tmp/config', work_dir='/tmp/foo', foo='bar',
|
||||
server='https://acme-server.org:443/new')
|
||||
server='https://acme-server.org:443/new',
|
||||
dvsni_port='1234', simple_http_port='4321')
|
||||
from letsencrypt.configuration import NamespaceConfig
|
||||
self.config = NamespaceConfig(self.namespace)
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ class BaseRenewableCertTest(unittest.TestCase):
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
|
||||
self.cli_config = configuration.RenewerConfiguration(
|
||||
namespace=mock.MagicMock(config_dir=self.tempdir))
|
||||
namespace=mock.MagicMock(
|
||||
config_dir=self.tempdir, no_simple_http_tls=False))
|
||||
# TODO: maybe provide RenewerConfiguration.make_dirs?
|
||||
os.makedirs(os.path.join(self.tempdir, "live", "example.org"))
|
||||
os.makedirs(os.path.join(self.tempdir, "archive", "example.org"))
|
||||
|
||||
Reference in New Issue
Block a user