mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 08:09:10 +02:00
Add _WebrootMapAction to webroot.py
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""Webroot plugin."""
|
||||
import argparse
|
||||
import errno
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from collections import defaultdict
|
||||
@@ -9,6 +11,7 @@ import six
|
||||
|
||||
from acme import challenges
|
||||
|
||||
from letsencrypt import cli
|
||||
from letsencrypt import errors
|
||||
from letsencrypt import interfaces
|
||||
from letsencrypt.plugins import common
|
||||
@@ -157,6 +160,17 @@ to serve all files under specified web root ({0})."""
|
||||
raise
|
||||
|
||||
|
||||
class _WebrootMapAction(argparse.Action):
|
||||
"""Action class for parsing webroot_map."""
|
||||
|
||||
def __call__(self, parser, namespace, webroot_map, option_string=None):
|
||||
for domains, webroot_path in six.iteritems(json.loads(webroot_map)):
|
||||
validated_webroot_path = _validate_webroot(webroot_path)
|
||||
namespace.webroot_map.update(
|
||||
(d, validated_webroot_path,)
|
||||
for d in cli.add_domains(namespace, domains))
|
||||
|
||||
|
||||
def _match_webroot_with_domains(args_or_config):
|
||||
"""Applies the most recent webroot path to all unmatched domains.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user