From ecdcc0697cd53592b54078175001755169436761 Mon Sep 17 00:00:00 2001 From: EsmerlinJM Date: Wed, 11 Dec 2024 11:23:13 -0300 Subject: [PATCH] [FIX]: check_hostname requires server_hostname in Magnum client Resolve issue with Magnum client when using HTTPS endpoints in Python 3.12. The error occurs due to `check_hostname` requiring `server_hostname` to be set when `CERT_REQUIRED` is used in `SSLContext.wrap_socket`. References: - Python 3.12 SSL documentation: https://docs.python.org/3.12/library/ssl.html#ssl.SSLContext.check_hostname - Related Magnum client commit from version 4.6.0: https://opendev.org/openstack/python-magnumclient/commit/5d8fd3840052e07418e007f336deb99fd58b7e92 Closes-bug: https://bugs.launchpad.net/magnum/+bug/2091103 Change-Id: I0337d55c1b24ffce7c798a81a286989c402efcc1 --- magnumclient/common/httpclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magnumclient/common/httpclient.py b/magnumclient/common/httpclient.py index 7a6f51e7..32722168 100644 --- a/magnumclient/common/httpclient.py +++ b/magnumclient/common/httpclient.py @@ -307,7 +307,7 @@ class VerifiedHTTPSConnection(http_client.HTTPSConnection): if self.cert_file: context.load_cert_chain(self.cert_file, self.key_file) - self.sock = context.wrap_socket(sock) + self.sock = context.wrap_socket(sock, server_hostname=self.host) @staticmethod def get_system_ca_file():