Refactor config.server complexity out of parse_args

This commit is contained in:
Peter Eckersley
2016-04-06 17:10:30 -07:00
parent dd56066e47
commit 0bcc80756d
+16 -9
View File
@@ -318,6 +318,22 @@ class HelpfulArgumentParser(object):
parsed_args.noninteractive_mode = True
if parsed_args.staging or parsed_args.dry_run:
self.set_test_server(parsed_args)
if parsed_args.csr:
if parsed_args.allow_subset_of_names:
raise errors.Error("--allow-subset-of-names "
"cannot be used with --csr")
self.handle_csr(parsed_args)
hooks.validate_hooks(parsed_args)
return parsed_args
def set_test_server(self, parsed_args):
"We have --staging/--dry-run; perform sanity check and set config.server"
if parsed_args.server not in (flag_default("server"), constants.STAGING_URI):
conflicts = ["--staging"] if parsed_args.staging else []
conflicts += ["--dry-run"] if parsed_args.dry_run else []
@@ -337,15 +353,6 @@ class HelpfulArgumentParser(object):
parsed_args.tos = True
parsed_args.register_unsafely_without_email = True
if parsed_args.csr:
if parsed_args.allow_subset_of_names:
raise errors.Error("--allow-subset-of-names "
"cannot be used with --csr")
self.handle_csr(parsed_args)
hooks.validate_hooks(parsed_args)
return parsed_args
def handle_csr(self, parsed_args):
"""Process a --csr flag."""