From 53117b0ce0f9e781ae9a44570cfc7dc3891bb918 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Thu, 2 Mar 2017 17:27:29 -0800 Subject: [PATCH] Remove UnexpectedUpdate exceptions. (#4197) * Remove UnexpectedUpdate exceptions. These exceptions trigger when the server sends the client back an object with a field that doesn't exactly match what the client previously sent. This causes unnecessary breakage in various cases, doesn't prevent any problems, and isn't required by spec. * Back out all UnexpectedUpdate removals except registration update. --- acme/acme/client.py | 3 --- acme/acme/client_test.py | 10 ---------- certbot/client.py | 2 -- 3 files changed, 15 deletions(-) diff --git a/acme/acme/client.py b/acme/acme/client.py index ddcba7635..6c5ed79a2 100644 --- a/acme/acme/client.py +++ b/acme/acme/client.py @@ -134,8 +134,6 @@ class Client(object): # pylint: disable=too-many-instance-attributes update = regr.body if update is None else update body = messages.UpdateRegistration(**dict(update)) updated_regr = self._send_recv_regr(regr, body=body) - if updated_regr != regr: - raise errors.UnexpectedUpdate(regr) return updated_regr def deactivate_registration(self, regr): @@ -301,7 +299,6 @@ class Client(object): # pylint: disable=too-many-instance-attributes response = self.net.get(authzr.uri) updated_authzr = self._authzr_from_response( response, authzr.body.identifier, authzr.uri, authzr.new_cert_uri) - # TODO: check and raise UnexpectedUpdate return updated_authzr, response def request_issuance(self, csr, authzrs): diff --git a/acme/acme/client_test.py b/acme/acme/client_test.py index b3db21ac9..7e7ffe779 100644 --- a/acme/acme/client_test.py +++ b/acme/acme/client_test.py @@ -121,8 +121,6 @@ class ClientTest(unittest.TestCase): # TODO: split here and separate test self.response.json.return_value = self.regr.body.update( contact=()).to_json() - self.assertRaises( - errors.UnexpectedUpdate, self.client.update_registration, self.regr) def test_deactivate_account(self): self.response.headers['Location'] = self.regr.uri @@ -130,14 +128,6 @@ class ClientTest(unittest.TestCase): self.assertEqual(self.regr, self.client.deactivate_registration(self.regr)) - def test_deactivate_account_bad_registration_returned(self): - self.response.headers['Location'] = self.regr.uri - self.response.json.return_value = "some wrong registration thing" - self.assertRaises( - errors.UnexpectedUpdate, - self.client.deactivate_registration, - self.regr) - def test_query_registration(self): self.response.json.return_value = self.regr.body.to_json() self.assertEqual(self.regr, self.client.query_registration(self.regr)) diff --git a/certbot/client.py b/certbot/client.py index 95882a9fc..a342c1bf3 100644 --- a/certbot/client.py +++ b/certbot/client.py @@ -155,8 +155,6 @@ def perform_registration(acme, config): :returns: Registration Resource. :rtype: `acme.messages.RegistrationResource` - - :raises .UnexpectedUpdate: """ try: return acme.register(messages.NewRegistration.from_data(email=config.email))