From 3603f482e5fe81cb5948699a77a2abaa16a8839d Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Tue, 9 Feb 2016 10:06:59 -0800 Subject: [PATCH] Resume using a fully-constructed config namespace --- letsencrypt/cli.py | 4 ++-- letsencrypt/configuration.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index 35211c0bd..a385f5e05 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -744,8 +744,8 @@ def _set_by_cli(var): plugins = plugins_disco.PluginsRegistry.find_all() # reconstructed_args == sys.argv[1:], or whatever was passed to main() reconstructed_args = _parser.args + [_parser.verb] - _set_by_cli.detector = prepare_and_parse_args(plugins, reconstructed_args, - detect_defaults=True) + default_args = prepare_and_parse_args(plugins, reconstructed_args, detect_defaults=True) + _set_by_cli.detector = configuration.NamespaceConfig(default_args, fake=True) try: # Is detector.var something that isn't false? diff --git a/letsencrypt/configuration.py b/letsencrypt/configuration.py index 2bbf1b019..979d5e985 100644 --- a/letsencrypt/configuration.py +++ b/letsencrypt/configuration.py @@ -34,7 +34,7 @@ class NamespaceConfig(object): """ zope.interface.implements(interfaces.IConfig) - def __init__(self, namespace): + def __init__(self, namespace, fake=False): self.namespace = namespace self.namespace.config_dir = os.path.abspath(self.namespace.config_dir) @@ -42,7 +42,8 @@ class NamespaceConfig(object): self.namespace.logs_dir = os.path.abspath(self.namespace.logs_dir) # Check command line parameters sanity, and error out in case of problem. - check_config_sanity(self) + if not fake: + check_config_sanity(self) def __getattr__(self, name): return getattr(self.namespace, name)