Skip to content

Commit 305ebe1

Browse files
wgreenbergjsha
andauthored
Fix --webroot-path action (#10509) (#10510)
Cherry-picks #10509 which fixes #10506. This will eventually make its way into the 5.2.2 point release Co-authored-by: Jacob Hoffman-Andrews <[email protected]>
1 parent d3c30cf commit 305ebe1

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎certbot/src/certbot/_internal/plugins/webroot.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def __call__(self, parser: argparse.ArgumentParser, namespace: argparse.Namespac
320320
# domains before setting the new webroot path
321321
prev_webroot = namespace.webroot_path[-1]
322322
for domain in namespace.domains:
323-
namespace.webroot_map.setdefault(domain, prev_webroot)
323+
namespace.webroot_map.setdefault(domain.dns_name, prev_webroot)
324324
elif namespace.domains:
325325
self._domain_before_webroot = True
326326

‎certbot/src/certbot/_internal/tests/plugins/webroot_test.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from certbot.compat import filesystem
2121
from certbot.compat import os
2222
from certbot.display import util as display_util
23+
from certbot._internal import cli
2324
from certbot.tests import acme_util
2425
from certbot.tests import util as test_util
2526

@@ -302,7 +303,6 @@ def test_cleanup_failure(self, mock_rmdir):
302303
assert not os.path.exists(self.validation_path)
303304
assert os.path.exists(self.root_challenge_path)
304305

305-
306306
class WebrootActionTest(unittest.TestCase):
307307
"""Tests for webroot argparse actions."""
308308

@@ -314,7 +314,7 @@ def setUp(self):
314314
self.path = tempfile.mkdtemp()
315315
self.parser = argparse.ArgumentParser()
316316
self.parser.add_argument("-d", "--domains",
317-
action="append", default=[])
317+
action=cli._DomainsAction, default=[])
318318
Authenticator.inject_parser_options(self.parser, "webroot")
319319

320320
def test_webroot_map_action(self):

‎newsfragments/10509.fixed‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a regression that caused certbot to crash if multiple --webroot-path values were set on the command line.

0 commit comments

Comments
 (0)