Move _relevant from cli.py to storage.py

This commit is contained in:
Seth Schoen
2016-03-14 20:58:20 -07:00
parent d5d514c14f
commit 1f22b3cbef
2 changed files with 17 additions and 15 deletions
-14
View File
@@ -537,20 +537,6 @@ def diagnose_configurator_problem(cfg_type, requested, plugins):
raise errors.PluginSelectionError(msg)
def _relevant(option):
"""
Is this option one that could be restored and used for future renewal purposes?
:param str option: the name of the option
:rtype: bool
"""
# The list() here produces a list of the plugin names as strings.
plugins = list(plugins_disco.PluginsRegistry.find_all())
return (option in STR_CONFIG_ITEMS
or option in INT_CONFIG_ITEMS
or any(option.startswith(x + "_") for x in plugins))
def set_configurator(previously, now):
"""
Setting configurators multiple ways is okay, as long as they all agree
+17 -1
View File
@@ -122,6 +122,22 @@ def get_link_target(link):
return os.path.abspath(target)
def _relevant(option):
"""
Is this option one that could be restored for future renewal purposes?
:param str option: the name of the option
:rtype: bool
"""
# The list() here produces a list of the plugin names as strings.
from letsencrypt import cli
from letsencrypt.plugins import disco as plugins_disco
plugins = list(plugins_disco.PluginsRegistry.find_all())
return (option in cli.STR_CONFIG_ITEMS
or option in cli.INT_CONFIG_ITEMS
or any(option.startswith(x + "_") for x in plugins))
def relevant_values(all_values):
"""Return a new dict containing only items relevant for renewal.
@@ -150,7 +166,7 @@ def relevant_values(all_values):
# renewal config. It can be stored if it is relevant and
# (it is _set_by_cli() or flag_default() is different
# from the value or flag_default() doesn't exist).
if cli._relevant(option):
if _relevant(option):
if (cli._set_by_cli(option)
or not _is_cli_default(option, value)):
# or option not in constants.CLI_DEFAULTS