diff --git a/certbot-apache/certbot_apache/_internal/configurator.py b/certbot-apache/certbot_apache/_internal/configurator.py index 8c644c265..172817547 100644 --- a/certbot-apache/certbot_apache/_internal/configurator.py +++ b/certbot-apache/certbot_apache/_internal/configurator.py @@ -242,7 +242,7 @@ class ApacheConfigurator(common.Installer): try: with open(ssl_module_location, mode="rb") as f: contents = f.read() - except IOError as error: + except IOError: return None return contents diff --git a/certbot-apache/tests/configurator_test.py b/certbot-apache/tests/configurator_test.py index 9bb9a83b4..cbeb73fec 100644 --- a/certbot-apache/tests/configurator_test.py +++ b/certbot-apache/tests/configurator_test.py @@ -1836,6 +1836,10 @@ class InstallSslOptionsConfTest(util.ApacheTest): self.assertEqual(self.config.openssl_version(), None) self.assertTrue("Could not find OpenSSL" in mock_log.call_args[0][0]) + def test_open_module_file(self): + mock_open = mock.mock_open(read_data="testing 12 3") + with mock.patch("certbot_apache._internal.configurator.open", mock_open): + self.assertEqual (self.config._open_module_file("/nonsense/"), "testing 12 3") if __name__ == "__main__": unittest.main() # pragma: no cover