mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 18:56:55 +02:00
Fix enable_mod register_undo_command in challenges
This commit is contained in:
@@ -482,7 +482,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
logger.debug(msg)
|
logger.debug(msg)
|
||||||
self.save_notes += msg
|
self.save_notes += msg
|
||||||
|
|
||||||
def prepare_server_https(self, port):
|
def prepare_server_https(self, port, temp=False):
|
||||||
"""Prepare the server for HTTPS.
|
"""Prepare the server for HTTPS.
|
||||||
|
|
||||||
Make sure that the ssl_module is loaded and that the server
|
Make sure that the ssl_module is loaded and that the server
|
||||||
@@ -493,7 +493,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
"""
|
"""
|
||||||
if "ssl_module" not in self.parser.modules:
|
if "ssl_module" not in self.parser.modules:
|
||||||
logger.info("Loading mod_ssl into Apache Server")
|
logger.info("Loading mod_ssl into Apache Server")
|
||||||
self.enable_mod("ssl")
|
self.enable_mod("ssl", temp)
|
||||||
|
|
||||||
# Check for Listen <port>
|
# Check for Listen <port>
|
||||||
# Note: This could be made to also look for ip:443 combo
|
# Note: This could be made to also look for ip:443 combo
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class ApacheDvsni(common.Dvsni):
|
|||||||
|
|
||||||
# Prepare the server for HTTPS
|
# Prepare the server for HTTPS
|
||||||
self.configurator.prepare_server_https(
|
self.configurator.prepare_server_https(
|
||||||
str(self.configurator.config.dvsni_port))
|
str(self.configurator.config.dvsni_port), True)
|
||||||
|
|
||||||
responses = []
|
responses = []
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ class DvsniPerformTest(util.ApacheTest):
|
|||||||
@mock.patch("letsencrypt.le_util.exe_exists")
|
@mock.patch("letsencrypt.le_util.exe_exists")
|
||||||
@mock.patch("letsencrypt.le_util.run_script")
|
@mock.patch("letsencrypt.le_util.run_script")
|
||||||
def test_perform1(self, _, mock_exists):
|
def test_perform1(self, _, mock_exists):
|
||||||
|
mock_register = mock.Mock()
|
||||||
|
self.sni.configurator.reverter.register_undo_command = mock_register
|
||||||
|
|
||||||
mock_exists.return_value = True
|
mock_exists.return_value = True
|
||||||
self.sni.configurator.parser.update_runtime_variables = mock.Mock()
|
self.sni.configurator.parser.update_runtime_variables = mock.Mock()
|
||||||
|
|
||||||
@@ -50,6 +53,9 @@ class DvsniPerformTest(util.ApacheTest):
|
|||||||
|
|
||||||
responses = self.sni.perform()
|
responses = self.sni.perform()
|
||||||
|
|
||||||
|
# Make sure that register_undo_command was called into temp directory.
|
||||||
|
self.assertEqual(True, mock_register.call_args[0][0])
|
||||||
|
|
||||||
mock_setup_cert.assert_called_once_with(achall)
|
mock_setup_cert.assert_called_once_with(achall)
|
||||||
|
|
||||||
# Check to make sure challenge config path is included in apache config.
|
# Check to make sure challenge config path is included in apache config.
|
||||||
|
|||||||
Reference in New Issue
Block a user