mirror of
https://github.com/certbot/certbot.git
synced 2026-06-09 00:32:12 -04:00
restore allow_subset_of_names
This commit is contained in:
parent
2bbf28b4b9
commit
36c9c49ab9
1 changed files with 22 additions and 1 deletions
|
|
@ -27,10 +27,11 @@ logger = logging.getLogger(__name__)
|
|||
# file's renewalparams and actually used in the client configuration
|
||||
# during the renewal process. We have to record their types here because
|
||||
# the renewal configuration process loses this information.
|
||||
BOOL_CONFIG_ITEMS = ["allow_subset_of_names"]
|
||||
INT_CONFIG_ITEMS = ["rsa_key_size", "tls_sni_01_port", "http01_port"]
|
||||
STR_CONFIG_ITEMS = ["config_dir", "logs_dir", "work_dir", "user_agent",
|
||||
"server", "account", "authenticator", "installer",
|
||||
"standalone_supported_challenges", "renew_hook"]
|
||||
INT_CONFIG_ITEMS = ["rsa_key_size", "tls_sni_01_port", "http01_port"]
|
||||
|
||||
|
||||
def _reconstitute(config, full_path):
|
||||
|
|
@ -159,6 +160,7 @@ def _restore_required_config_elements(config, renewalparams):
|
|||
|
||||
"""
|
||||
required_items = itertools.chain(
|
||||
six.moves.zip(BOOL_CONFIG_ITEMS, itertools.repeat(_restore_bool)),
|
||||
six.moves.zip(INT_CONFIG_ITEMS, itertools.repeat(_restore_int)),
|
||||
six.moves.zip(STR_CONFIG_ITEMS, itertools.repeat(_restore_str)))
|
||||
for item_name, restore_func in required_items:
|
||||
|
|
@ -167,6 +169,25 @@ def _restore_required_config_elements(config, renewalparams):
|
|||
setattr(config.namespace, item_name, value)
|
||||
|
||||
|
||||
def _restore_bool(name, value):
|
||||
"""Restores an boolean key-value pair from a renewal config file.
|
||||
|
||||
:param str name: option name
|
||||
:param str value: option value
|
||||
|
||||
:returns: converted option value to be stored in the runtime config
|
||||
:rtype: bool
|
||||
|
||||
:raises errors.Error: if value can't be converted to an bool
|
||||
|
||||
"""
|
||||
lowercase_value = value.lower()
|
||||
if lowercase_value not in ("true", "false"):
|
||||
raise errors.Error(
|
||||
"Expected True or False for {0} but found {1}".format(name, value))
|
||||
return lowercase_value == "true"
|
||||
|
||||
|
||||
def _restore_int(name, value):
|
||||
"""Restores an integer key-value pair from a renewal config file.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue