mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:02:52 +02:00
--webroot-root -> --webroot-path
This commit is contained in:
@@ -29,11 +29,11 @@ system. It expects that there is some other HTTP server configured
|
|||||||
to serve all files under specified web root ({0})."""
|
to serve all files under specified web root ({0})."""
|
||||||
|
|
||||||
def more_info(self): # pylint: disable=missing-docstring,no-self-use
|
def more_info(self): # pylint: disable=missing-docstring,no-self-use
|
||||||
return self.MORE_INFO.format(self.conf("root"))
|
return self.MORE_INFO.format(self.conf("path"))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_parser_arguments(cls, add):
|
def add_parser_arguments(cls, add):
|
||||||
add("root", help="public_html / webroot path")
|
add("path", help="public_html / webroot path")
|
||||||
|
|
||||||
def get_chall_pref(self, domain): # pragma: no cover
|
def get_chall_pref(self, domain): # pragma: no cover
|
||||||
# pylint: disable=missing-docstring,no-self-use,unused-argument
|
# pylint: disable=missing-docstring,no-self-use,unused-argument
|
||||||
@@ -44,15 +44,15 @@ to serve all files under specified web root ({0})."""
|
|||||||
self.full_root = None
|
self.full_root = None
|
||||||
|
|
||||||
def prepare(self): # pylint: disable=missing-docstring
|
def prepare(self): # pylint: disable=missing-docstring
|
||||||
root = self.conf("root")
|
path = self.conf("path")
|
||||||
if root is None:
|
if path is None:
|
||||||
raise errors.PluginError("--{0} must be set".format(
|
raise errors.PluginError("--{0} must be set".format(
|
||||||
self.option_name("root")))
|
self.option_name("path")))
|
||||||
if not os.path.isdir(root):
|
if not os.path.isdir(path):
|
||||||
raise errors.PluginError(
|
raise errors.PluginError(
|
||||||
root + " does not exist or is not a directory")
|
path + " does not exist or is not a directory")
|
||||||
self.full_root = os.path.join(
|
self.full_root = os.path.join(
|
||||||
root, challenges.SimpleHTTPResponse.URI_ROOT_PATH)
|
path, challenges.SimpleHTTPResponse.URI_ROOT_PATH)
|
||||||
|
|
||||||
logger.debug("Creating root challenges validation dir at %s",
|
logger.debug("Creating root challenges validation dir at %s",
|
||||||
self.full_root)
|
self.full_root)
|
||||||
|
|||||||
@@ -26,21 +26,21 @@ class AuthenticatorTest(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from letsencrypt.plugins.webroot import Authenticator
|
from letsencrypt.plugins.webroot import Authenticator
|
||||||
self.root = tempfile.mkdtemp()
|
self.path = tempfile.mkdtemp()
|
||||||
self.validation_path = os.path.join(
|
self.validation_path = os.path.join(
|
||||||
self.root, ".well-known", "acme-challenge",
|
self.path, ".well-known", "acme-challenge",
|
||||||
"ZXZhR3hmQURzNnBTUmIyTEF2OUlaZjE3RHQzanV4R0orUEN0OTJ3citvQQ")
|
"ZXZhR3hmQURzNnBTUmIyTEF2OUlaZjE3RHQzanV4R0orUEN0OTJ3citvQQ")
|
||||||
self.config = mock.MagicMock(webroot_root=self.root)
|
self.config = mock.MagicMock(webroot_path=self.path)
|
||||||
self.auth = Authenticator(self.config, "webroot")
|
self.auth = Authenticator(self.config, "webroot")
|
||||||
self.auth.prepare()
|
self.auth.prepare()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
shutil.rmtree(self.root)
|
shutil.rmtree(self.path)
|
||||||
|
|
||||||
def test_more_info(self):
|
def test_more_info(self):
|
||||||
more_info = self.auth.more_info()
|
more_info = self.auth.more_info()
|
||||||
self.assertTrue(isinstance(more_info, str))
|
self.assertTrue(isinstance(more_info, str))
|
||||||
self.assertTrue(self.root in more_info)
|
self.assertTrue(self.path in more_info)
|
||||||
|
|
||||||
def test_add_parser_arguments(self):
|
def test_add_parser_arguments(self):
|
||||||
add = mock.MagicMock()
|
add = mock.MagicMock()
|
||||||
@@ -48,11 +48,11 @@ class AuthenticatorTest(unittest.TestCase):
|
|||||||
self.assertEqual(1, add.call_count)
|
self.assertEqual(1, add.call_count)
|
||||||
|
|
||||||
def test_prepare_bad_root(self):
|
def test_prepare_bad_root(self):
|
||||||
self.config.webroot_root = os.path.join(self.root, "null")
|
self.config.webroot_path = os.path.join(self.path, "null")
|
||||||
self.assertRaises(errors.PluginError, self.auth.prepare)
|
self.assertRaises(errors.PluginError, self.auth.prepare)
|
||||||
|
|
||||||
def test_prepare_missing_root(self):
|
def test_prepare_missing_root(self):
|
||||||
self.config.webroot_root = None
|
self.config.webroot_path = None
|
||||||
self.assertRaises(errors.PluginError, self.auth.prepare)
|
self.assertRaises(errors.PluginError, self.auth.prepare)
|
||||||
|
|
||||||
def test_prepare_full_root_exists(self):
|
def test_prepare_full_root_exists(self):
|
||||||
@@ -60,10 +60,10 @@ class AuthenticatorTest(unittest.TestCase):
|
|||||||
self.auth.prepare() # shouldn't raise any exceptions
|
self.auth.prepare() # shouldn't raise any exceptions
|
||||||
|
|
||||||
def test_prepare_reraises_other_errors(self):
|
def test_prepare_reraises_other_errors(self):
|
||||||
self.auth.full_root = os.path.join(self.root, "null")
|
self.auth.full_path = os.path.join(self.path, "null")
|
||||||
os.chmod(self.root, 0o000)
|
os.chmod(self.path, 0o000)
|
||||||
self.assertRaises(errors.PluginError, self.auth.prepare)
|
self.assertRaises(errors.PluginError, self.auth.prepare)
|
||||||
os.chmod(self.root, 0o700)
|
os.chmod(self.path, 0o700)
|
||||||
|
|
||||||
def test_perform_cleanup(self):
|
def test_perform_cleanup(self):
|
||||||
responses = self.auth.perform([self.achall])
|
responses = self.auth.perform([self.achall])
|
||||||
|
|||||||
Reference in New Issue
Block a user