Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Warren <bmw@users.noreply.github.com>2019-04-05 09:54:43 +0300
committerAdrien Ferrand <adferrand@users.noreply.github.com>2019-04-05 09:54:43 +0300
commitf2b071f8f40e985aa717af1ac72dad209cc85a99 (patch)
treeabaf904a5e96e6d0d29c1df785fc56fb44def6f5
parent6590875a1a0aa539737d9026dd1995edab27bc98 (diff)
Don't search for plugins once for each config item (#6917)
-rw-r--r--certbot/storage.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/certbot/storage.py b/certbot/storage.py
index d0bc36c08..48587ba40 100644
--- a/certbot/storage.py
+++ b/certbot/storage.py
@@ -238,16 +238,17 @@ def _write_live_readme_to(readme_path, is_base_dir=False):
"certificates.\n".format(prefix=prefix))
-def _relevant(option):
+def _relevant(namespaces, option):
"""
Is this option one that could be restored for future renewal purposes?
+
+ :param namespaces: plugin namespaces for configuration options
+ :type namespaces: `list` of `str`
:param str option: the name of the option
:rtype: bool
"""
from certbot import renewal
- plugins = plugins_disco.PluginsRegistry.find_all()
- namespaces = [plugins_common.dest_namespace(plugin) for plugin in plugins]
return (option in renewal.CONFIG_ITEMS or
any(option.startswith(namespace) for namespace in namespaces))
@@ -262,10 +263,13 @@ def relevant_values(all_values):
:rtype dict:
"""
+ plugins = plugins_disco.PluginsRegistry.find_all()
+ namespaces = [plugins_common.dest_namespace(plugin) for plugin in plugins]
+
rv = dict(
(option, value)
for option, value in six.iteritems(all_values)
- if _relevant(option) and cli.option_was_set(option, value))
+ if _relevant(namespaces, option) and cli.option_was_set(option, value))
# We always save the server value to help with forward compatibility
# and behavioral consistency when versions of Certbot with different
# server defaults are used.