mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
Sane error message in case user tries to use apache-handle-sites functionality in non-supported environment.
This commit is contained in:
parent
48b1240451
commit
4d31a8cb39
2 changed files with 10 additions and 0 deletions
|
|
@ -1119,6 +1119,12 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
"""
|
||||
|
||||
enabled_dir = os.path.join(self.parser.root, "sites-enabled")
|
||||
if not os.path.isdir(enabled_dir):
|
||||
error_msg = ("Directory '{0}' does not exist. Please ensure "
|
||||
"that the values for --apache-handle-sites and "
|
||||
"--apache-server-root are correct for your "
|
||||
"environment.".format(enabled_dir))
|
||||
raise errors.ConfigurationError(error_msg)
|
||||
for entry in os.listdir(enabled_dir):
|
||||
try:
|
||||
if filecmp.cmp(avail_fp, os.path.join(enabled_dir, entry)):
|
||||
|
|
|
|||
|
|
@ -219,6 +219,10 @@ class TwoVhost80Test(util.ApacheTest):
|
|||
self.assertFalse(self.config.is_site_enabled(self.vh_truth[1].filep))
|
||||
self.assertTrue(self.config.is_site_enabled(self.vh_truth[2].filep))
|
||||
self.assertTrue(self.config.is_site_enabled(self.vh_truth[3].filep))
|
||||
with mock.patch("os.path.isdir") as mock_isdir:
|
||||
mock_isdir.return_value = False
|
||||
with (self.assertRaises(errors.ConfigurationError)):
|
||||
self.config.is_site_enabled("irrelevant")
|
||||
|
||||
@mock.patch("letsencrypt.le_util.run_script")
|
||||
@mock.patch("letsencrypt.le_util.exe_exists")
|
||||
|
|
|
|||
Loading…
Reference in a new issue