Fix more bugs

* setting --dry-run or --staging implies changing account
  * --dry-run: be willing to make a staging account if the user only
    has a prod one
This commit is contained in:
Peter Eckersley
2016-02-09 14:19:53 -08:00
parent ed348f5528
commit 6ca84acc1c
+9 -1
View File
@@ -416,7 +416,6 @@ def _suggest_donation_if_appropriate(config):
reporter_util.add_message(msg, reporter_util.LOW_PRIORITY)
def _report_successful_dry_run(config):
reporter_util = zope.component.getUtility(interfaces.IReporter)
if config.verb != "renew":
@@ -772,6 +771,10 @@ def _set_by_cli(var):
if change_detected:
return True
# Special case: we actually want account to be set to "" if the server
# the account was on has changed
elif var == "account" and (detector.server or detector.dry_run or detector.staging):
return True
# Special case: vars like --no-redirect that get set True -> False
# default to None; False means they were set
elif var in detector.store_false_vars and change_detected is not None:
@@ -1209,6 +1212,11 @@ class HelpfulArgumentParser(object):
raise errors.Error("--dry-run currently only works with the "
"'certonly' or 'renew' subcommands (%r)" % self.verb)
parsed_args.break_my_certs = parsed_args.staging = True
if glob.glob(os.path.join(parsed_args.config_dir, constants.ACCOUNTS_DIR, "*")):
# The user has a prod account, but might not have a staging
# one; we don't want to start trying to perform interactive registration
parsed_args.agree_tos = True
parsed_args.register_unsafely_without_email = True
if parsed_args.csr:
self.handle_csr(parsed_args)