From 2bec5c6c9f20ddae2a15f222719e6a05d59e80ad Mon Sep 17 00:00:00 2001 From: Johannes Kampmeyer Date: Tue, 26 Nov 2019 09:03:58 +0100 Subject: Fix assumptions for earlier python versions --- src/lib/Bcfg2/Client/Proxy.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/Bcfg2/Client/Proxy.py b/src/lib/Bcfg2/Client/Proxy.py index fe9f47f17..9ffae49d8 100644 --- a/src/lib/Bcfg2/Client/Proxy.py +++ b/src/lib/Bcfg2/Client/Proxy.py @@ -21,6 +21,7 @@ except ImportError: version = sys.version_info[:2] has_py26 = version >= (2, 6) has_py32 = version >= (3, 2) +has_py36 = version >= (3, 6) __all__ = ["ComponentProxy", "RetryMethod", @@ -199,8 +200,13 @@ class SSLHTTPConnection(httplib.HTTPConnection): elif self.protocol == 'xmlrpc/tlsv1': ssl_protocol_ver = ssl.PROTOCOL_TLSv1 elif self.protocol == 'xmlrpc/tls': - # needed for python 3.5+ support - ssl_protocol_ver = ssl.PROTOCOL_TLS + if has_py36: + ssl_protocol_ver = ssl.PROTOCOL_TLS + else: + self.logger.warning("Cannot use PROTOCOL_TLS, due to " + "python version. Switching to " + "PROTOCOL_TLSv1.") + ssl_protocol_ver = ssl.PROTOCOL_TLSv1 else: self.logger.error("Unknown protocol %s" % (self.protocol)) raise Exception("unknown protocol %s" % self.protocol) -- cgit v1.2.3-1-g7c22