From 15434963c586e3457bc8eac9c7f1d388a39cb1d7 Mon Sep 17 00:00:00 2001 From: Jesse Schmidt Date: Thu, 3 Oct 2024 09:21:31 -0700 Subject: [PATCH] fix: TOOLS-2976 manage truncate fails when set DNE --- lib/live_cluster/client/assocket.py | 4 ++-- lib/live_cluster/client/node.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/live_cluster/client/assocket.py b/lib/live_cluster/client/assocket.py index 6194b382..9ddf7b7f 100644 --- a/lib/live_cluster/client/assocket.py +++ b/lib/live_cluster/client/assocket.py @@ -98,11 +98,11 @@ async def _create_socket_for_addrinfo(self, addrinfo): """We are creating our own socket, optionally wrapping it with an SSL.Context (not the same as ssl.SSLContext) to get an SSL.Connection (same interface as a socket.socket). Further up the stack we pass this socket to asyncio.open_connection - to create streams. The perfered way of creating a socket would be to + to create streams. The preferred way of creating a socket would be to allow asyncio create the socket (ssl or not) by passing the ssl_context (or None) to asyncio.open_connection. However, ssl_context must be an instance of ssl.SSLContext, which is not compatible with SSL.Context which is what we use. SSL.Context enables a higher level of control over certificate verification which we need (see ./ssl_context.py). Another solution might be to create a custom implementation - of he asyncio Transport that uses pyOpenSSL.SSL.Context (or use https://github.com/horazont/aioopenssl) but that would be a + of the asyncio Transport that uses pyOpenSSL.SSL.Context (or use https://github.com/horazont/aioopenssl) but that would be a considerable amount of work. """ await asyncio.wait_for( diff --git a/lib/live_cluster/client/node.py b/lib/live_cluster/client/node.py index e95ce4a9..8b83ea00 100644 --- a/lib/live_cluster/client/node.py +++ b/lib/live_cluster/client/node.py @@ -1097,7 +1097,7 @@ async def info_all_namespace_statistics(self): async def info_set_statistics(self, namespace, set_): set_stat = await self._info("sets/{}/{}".format(namespace, set_)) - if set_stat[-1] == ";": + if set_stat and set_stat[-1] == ";": set_stat = client_util.info_colon_to_dict(set_stat[0:-1]) else: set_stat = client_util.info_colon_to_dict(set_stat)