From 17d35a23ed1d6671f4f22c0a95fd5ff995455910 Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Mon, 24 Sep 2018 18:37:25 -0700 Subject: [PATCH] cleanup stale consider_arrangement certificate filepaths --- nucypher/network/middleware.py | 4 ++-- nucypher/policy/models.py | 12 ++++++------ nucypher/utilities/sandbox/middleware.py | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/nucypher/network/middleware.py b/nucypher/network/middleware.py index a374d6a1a..aee7c1efd 100644 --- a/nucypher/network/middleware.py +++ b/nucypher/network/middleware.py @@ -7,11 +7,11 @@ from umbral.fragments import CapsuleFrag class RestMiddleware: - def consider_arrangement(self, arrangement, certificate_filepath): + def consider_arrangement(self, arrangement): node = arrangement.ursula response = requests.post("https://{}/consider_arrangement".format(node.rest_interface), bytes(arrangement), - verify=certificate_filepath) + verify=node.certificate_filepath) if not response.status_code == 200: raise RuntimeError("Bad response: {}".format(response.content)) diff --git a/nucypher/policy/models.py b/nucypher/policy/models.py index 2ebd35fd4..2ecec587f 100644 --- a/nucypher/policy/models.py +++ b/nucypher/policy/models.py @@ -241,14 +241,14 @@ class Policy: try: ursula.verify_node(network_middleware, accept_federated_only=arrangement.federated) except ursula.InvalidNode: - # TODO: What do we actually do here? Report this at least (355)? Maybe also have another bucket for invalid nodes? - # It's possible that nothing sordid is happening here; this node may be updating its interface info or rotating a signing key - # and we learned about a previous one. + # TODO: What do we actually do here? Report this at least (355)? + # Maybe also have another bucket for invalid nodes? + # It's possible that nothing sordid is happening here; + # this node may be updating its interface info or rotating a signing key + # and we learned about a previous one. raise - certificate_filepath = os.path.join(self.alice.known_metadata_dir, ursula.certificate_filename) - negotiation_response = network_middleware.consider_arrangement(arrangement=arrangement, - certificate_filepath=certificate_filepath) + negotiation_response = network_middleware.consider_arrangement(arrangement=arrangement) # TODO: check out the response: need to assess the result and see if we're actually good to go. negotiation_result = negotiation_response.status_code == 200 diff --git a/nucypher/utilities/sandbox/middleware.py b/nucypher/utilities/sandbox/middleware.py index bb0b4c353..8fa57e1b0 100644 --- a/nucypher/utilities/sandbox/middleware.py +++ b/nucypher/utilities/sandbox/middleware.py @@ -31,8 +31,7 @@ class MockRestMiddleware(RestMiddleware): "Can't find an Ursula with port {} - did you spin up the right test ursulas?".format(port)) return mock_client - def consider_arrangement(self, arrangement, certificate_filepath): - # assert os.path.isfile(certificate_filepath) + def consider_arrangement(self, arrangement): mock_client = self._get_mock_client_by_ursula(arrangement.ursula) response = mock_client.post("http://localhost/consider_arrangement", bytes(arrangement)) assert response.status_code == 200