mirror of
https://github.com/certbot/certbot.git
synced 2026-08-04 12:21:51 +02:00
Merge branch 'split-renew' into split-plugin-selection
This commit is contained in:
@@ -145,6 +145,16 @@ def set_by_cli(var):
|
|||||||
# static housekeeping var
|
# static housekeeping var
|
||||||
set_by_cli.detector = None
|
set_by_cli.detector = None
|
||||||
|
|
||||||
|
|
||||||
|
def argparse_type(variable):
|
||||||
|
"Return our argparse type function for a config variable (default: str)"
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
for action in helpful_parser.parser._actions:
|
||||||
|
if action.type is not None and action.dest == variable:
|
||||||
|
return action.type
|
||||||
|
return str
|
||||||
|
|
||||||
|
|
||||||
def read_file(filename, mode="rb"):
|
def read_file(filename, mode="rb"):
|
||||||
"""Returns the given file's contents.
|
"""Returns the given file's contents.
|
||||||
|
|
||||||
@@ -166,6 +176,10 @@ def read_file(filename, mode="rb"):
|
|||||||
|
|
||||||
def flag_default(name):
|
def flag_default(name):
|
||||||
"""Default value for CLI flag."""
|
"""Default value for CLI flag."""
|
||||||
|
# XXX: this is an internal housekeeping notion of defaults before
|
||||||
|
# argparse has been set up; it is not accurate for all flags. Call it
|
||||||
|
# with caution. Plugin defaults are missing, and some things are using
|
||||||
|
# defaults defined in this file, not in constants.py :(
|
||||||
return constants.CLI_DEFAULTS[name]
|
return constants.CLI_DEFAULTS[name]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-10
@@ -139,21 +139,14 @@ def _restore_plugin_configs(config, renewalparams):
|
|||||||
for config_item, config_value in six.iteritems(renewalparams):
|
for config_item, config_value in six.iteritems(renewalparams):
|
||||||
if config_item.startswith(plugin_prefix + "_") and not cli.set_by_cli(config_item):
|
if config_item.startswith(plugin_prefix + "_") and not cli.set_by_cli(config_item):
|
||||||
# Values None, True, and False need to be treated specially,
|
# Values None, True, and False need to be treated specially,
|
||||||
# As they don't get parsed correctly based on type
|
# As their types aren't handled correctly by configobj
|
||||||
if config_value in ("None", "True", "False"):
|
if config_value in ("None", "True", "False"):
|
||||||
# bool("False") == True
|
# bool("False") == True
|
||||||
# pylint: disable=eval-used
|
# pylint: disable=eval-used
|
||||||
setattr(config.namespace, config_item, eval(config_value))
|
setattr(config.namespace, config_item, eval(config_value))
|
||||||
continue
|
|
||||||
# If argparse has a type for this variable, use it:
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
for action in cli.helpful_parser.parser._actions:
|
|
||||||
if action.type is not None and action.dest == config_item:
|
|
||||||
setattr(config.namespace, config_item,
|
|
||||||
action.type(config_value))
|
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
setattr(config.namespace, config_item, str(config_value))
|
cast = cli.argparse_type(config_item)
|
||||||
|
setattr(config.namespace, config_item, cast(config_value))
|
||||||
|
|
||||||
|
|
||||||
def _restore_required_config_elements(config, renewalparams):
|
def _restore_required_config_elements(config, renewalparams):
|
||||||
|
|||||||
Reference in New Issue
Block a user