mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 02:44:21 +02:00
Use better update_registration invocation, and reporter interface
This commit is contained in:
+6
-12
@@ -10,7 +10,6 @@ import traceback
|
|||||||
|
|
||||||
import zope.component
|
import zope.component
|
||||||
|
|
||||||
from acme import errors as acme_errors
|
|
||||||
from acme import jose
|
from acme import jose
|
||||||
|
|
||||||
import certbot
|
import certbot
|
||||||
@@ -397,17 +396,12 @@ def register(config, unused_plugins):
|
|||||||
"required\n(hint: --email)")
|
"required\n(hint: --email)")
|
||||||
acc, acme = _determine_account(config)
|
acc, acme = _determine_account(config)
|
||||||
acme_client = client.Client(config, acc, None, None, acme=acme)
|
acme_client = client.Client(config, acc, None, None, acme=acme)
|
||||||
try:
|
data = acme_client.acme.update_registration(acc.regr.update(
|
||||||
updated_reg = client.messages.Registration.from_data(email=config.email)
|
body=acc.regr.body.update(contact=('mailto:' + config.email,))))
|
||||||
acme_client.acme.update_registration(acme_client.account.regr,
|
# We rely on an exception to interrupt this process if it didn't work.
|
||||||
updated_reg)
|
reporter_util = zope.component.getUtility(interfaces.IReporter)
|
||||||
except acme_errors.UnexpectedUpdate:
|
msg = "Your e-mail address was updated to {0}.".format(config.email)
|
||||||
# We expect the unexpected update!
|
reporter_util.add_message(msg, reporter_util.HIGH_PRIORITY)
|
||||||
pass
|
|
||||||
query_data = acme_client.acme.query_registration(acme_client.account.regr)
|
|
||||||
# We rely on an ACME exception to interrupt this process if it didn't work.
|
|
||||||
print("Registration change succeeded. New registration data:\n")
|
|
||||||
print(query_data)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user