diff --git a/certbot-apache/certbot_apache/override_centos.py b/certbot-apache/certbot_apache/override_centos.py index 6f104582b..5dcf608d6 100644 --- a/certbot-apache/certbot_apache/override_centos.py +++ b/certbot-apache/certbot_apache/override_centos.py @@ -8,9 +8,11 @@ import zope.interface from certbot import interfaces + from certbot_apache import apache_util from certbot_apache import configurator from certbot_apache import parser +from certbot.errors import ConfigurationError logger = logging.getLogger(__name__) @@ -80,13 +82,10 @@ class CentOSConfigurator(configurator.ApacheConfigurator): path_args = self.parser.get_all_args(noarg_path) if loadmod_args: if loadmod_args != path_args: - msg = ("Multiple different LoadModule directives for mod_ssl were " - "found. If you encounter issues with resulting configuration, " - "it's suggested to move the LoadModule ssl_module directive " - "to the beginning of main Apache configuration file at " - "{}").format(self.parser.loc["default"]) - logger.info(msg) - return + msg = ("Certbot encountered multiple different LoadModule directives " + "for LoadModule ssl_module. Please remove or comment out the " + "one(s) that are not in use.") + raise ConfigurationError(msg) else: loadmod_args = path_args diff --git a/certbot-apache/certbot_apache/tests/centos6_test.py b/certbot-apache/certbot_apache/tests/centos6_test.py index 7ee927248..f74b3193a 100644 --- a/certbot-apache/certbot_apache/tests/centos6_test.py +++ b/certbot-apache/certbot_apache/tests/centos6_test.py @@ -2,12 +2,11 @@ import os import unittest -import mock - from certbot_apache import obj from certbot_apache import override_centos from certbot_apache import parser from certbot_apache.tests import util +from certbot.errors import ConfigurationError def get_vh_truth(temp_dir, config_name): """Return the ground truth for the specified directory.""" @@ -153,12 +152,10 @@ class CentOS6Tests(util.ApacheTest): self.config.assoc["test.example.com"] = self.vh_truth[0] pre_matches = self.config.parser.find_dir("LoadModule", "ssl_module", exclude=False) - with mock.patch("certbot_apache.override_centos.logger.info") as mock_log: - self.config.deploy_cert( + + self.assertRaises(ConfigurationError, self.config.deploy_cert, "random.demo", "example/cert.pem", "example/key.pem", "example/cert_chain.pem", "example/fullchain.pem") - self.assertTrue(mock_log.called) - self.assertTrue("Multiple different LoadModule" in mock_log.call_args[0][0]) post_matches = self.config.parser.find_dir("LoadModule", "ssl_module", exclude=False)