From 960c570153d289da019bdcee29787b04db662055 Mon Sep 17 00:00:00 2001 From: eaglegai <31752768+eaglegai@users.noreply.github.com> Date: Fri, 28 Jun 2024 01:14:01 +0800 Subject: [PATCH] fix: Add get_connection_with_tls_context() for requests 2.32.2+ (#5435) get_connection() is deprecated in requests 2.32.2+ so this will allow for the LXDSocketAdapter to avoid using a deprecated api. Fixes GH-5434 Signed-off-by: eaglegai --- cloudinit/sources/DataSourceLXD.py | 7 +++++++ tools/.github-cla-signers | 1 + 2 files changed, 8 insertions(+) diff --git a/cloudinit/sources/DataSourceLXD.py b/cloudinit/sources/DataSourceLXD.py index 9d7d7a1ad10..a85853ec44a 100644 --- a/cloudinit/sources/DataSourceLXD.py +++ b/cloudinit/sources/DataSourceLXD.py @@ -132,6 +132,13 @@ class LXDSocketAdapter(HTTPAdapter): def get_connection(self, url, proxies=None): return SocketConnectionPool(LXD_SOCKET_PATH) + # Fix for requests 2.32.2+: + # https://github.com/psf/requests/pull/6710 + def get_connection_with_tls_context( + self, request, verify, proxies=None, cert=None + ): + return self.get_connection(request.url, proxies) + def _raw_instance_data_to_dict(metadata_type: str, metadata_value) -> dict: """Convert raw instance data from str, bytes, YAML to dict diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers index 29147fb0dbc..4db2e14df6d 100644 --- a/tools/.github-cla-signers +++ b/tools/.github-cla-signers @@ -55,6 +55,7 @@ dermotbradley dhalturin dhensby Dorthu +eaglegai eandersson eb3095 ederst