mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 16:19:13 +02:00
Use setattr in NamespaceConfig (#4362)
* set setattr in NamespaceConfig * remove unnecessary uses of .namespace * add simple test to ensure it works
This commit is contained in:
committed by
Peter Eckersley
parent
57f527f818
commit
edcfc49303
+5
-5
@@ -103,13 +103,13 @@ def _restore_webroot_config(config, renewalparams):
|
||||
"""
|
||||
if "webroot_map" in renewalparams:
|
||||
if not cli.set_by_cli("webroot_map"):
|
||||
config.namespace.webroot_map = renewalparams["webroot_map"]
|
||||
config.webroot_map = renewalparams["webroot_map"]
|
||||
elif "webroot_path" in renewalparams:
|
||||
logger.debug("Ancient renewal conf file without webroot-map, restoring webroot-path")
|
||||
wp = renewalparams["webroot_path"]
|
||||
if isinstance(wp, str): # prior to 0.1.0, webroot_path was a string
|
||||
wp = [wp]
|
||||
config.namespace.webroot_path = wp
|
||||
config.webroot_path = wp
|
||||
|
||||
|
||||
def _restore_plugin_configs(config, renewalparams):
|
||||
@@ -148,10 +148,10 @@ def _restore_plugin_configs(config, renewalparams):
|
||||
if config_value in ("None", "True", "False"):
|
||||
# bool("False") == True
|
||||
# pylint: disable=eval-used
|
||||
setattr(config.namespace, config_item, eval(config_value))
|
||||
setattr(config, config_item, eval(config_value))
|
||||
else:
|
||||
cast = cli.argparse_type(config_item)
|
||||
setattr(config.namespace, config_item, cast(config_value))
|
||||
setattr(config, config_item, cast(config_value))
|
||||
|
||||
|
||||
def restore_required_config_elements(config, renewalparams):
|
||||
@@ -172,7 +172,7 @@ def restore_required_config_elements(config, renewalparams):
|
||||
for item_name, restore_func in required_items:
|
||||
if item_name in renewalparams and not cli.set_by_cli(item_name):
|
||||
value = restore_func(item_name, renewalparams[item_name])
|
||||
setattr(config.namespace, item_name, value)
|
||||
setattr(config, item_name, value)
|
||||
|
||||
|
||||
def _restore_pref_challs(unused_name, value):
|
||||
|
||||
Reference in New Issue
Block a user