From 7767975204e82c4764964dd5a84af448b4eaed08 Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Tue, 16 Aug 2016 16:13:31 -0700 Subject: [PATCH] move error outside of get_email --- certbot/client.py | 10 ++++++++-- certbot/display/ops.py | 5 +---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/certbot/client.py b/certbot/client.py index 119fb0947..cb8fc623c 100644 --- a/certbot/client.py +++ b/certbot/client.py @@ -150,8 +150,14 @@ def perform_registration(acme, config): return acme.register(messages.NewRegistration.from_data(email=config.email)) except messages.Error as e: if e.typ == "urn:acme:error:invalidEmail": - config.namespace.email = display_ops.get_email(invalid=True) - return perform_registration(acme, config) + if config.noninteractive_mode: + msg = ("The email you specified was unable to be verified " + "by acme. Please ensure it is a valid email and " + "attempt registration again.") + raise erros.MissingCommandlineFlag(msg) + else: + config.namespace.email = display_ops.get_email(invalid=True) + return perform_registration(acme, config) else: raise diff --git a/certbot/display/ops.py b/certbot/display/ops.py index 901e7cd04..e8520fe96 100644 --- a/certbot/display/ops.py +++ b/certbot/display/ops.py @@ -48,10 +48,7 @@ def get_email(invalid=False, optional=True): invalid_prefix + msg if invalid else msg) except errors.MissingCommandlineFlag: msg = ("You should register before running non-interactively, " - "or provide --agree-tos and --email flags. " - "If you have specified an email with the --email flag, " - "please make sure that you entered it correctly and the " - "domain is valid.") + "or provide --agree-tos and --email flags.") raise errors.MissingCommandlineFlag(msg) if code != display_util.OK: