From 3840765e2bad1780148032f5191fe08c9b058309 Mon Sep 17 00:00:00 2001 From: Andrei Tsaregorodtsev Date: Fri, 23 Feb 2024 11:26:34 +0100 Subject: [PATCH] sweep: #7478 Fix DISET calls with proxy to be used passed as an argument --- src/DIRAC/Core/DISET/private/Transports/SSL/M2Utils.py | 2 ++ src/DIRAC/Core/DISET/private/Transports/SSLTransport.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DIRAC/Core/DISET/private/Transports/SSL/M2Utils.py b/src/DIRAC/Core/DISET/private/Transports/SSL/M2Utils.py index cc9256743f0..d1257994e44 100644 --- a/src/DIRAC/Core/DISET/private/Transports/SSL/M2Utils.py +++ b/src/DIRAC/Core/DISET/private/Transports/SSL/M2Utils.py @@ -101,6 +101,8 @@ def getM2SSLContext(ctx=None, **kwargs): with tempfile.NamedTemporaryFile(mode="w") as tmpFile: tmpFilePath = tmpFile.name tmpFile.write(kwargs["proxyString"]) + # Flush, otherwise the file is empty in the subsequent call + tmpFile.flush() __loadM2SSLCTXProxy(ctx, proxyPath=tmpFilePath) else: # Use normal proxy diff --git a/src/DIRAC/Core/DISET/private/Transports/SSLTransport.py b/src/DIRAC/Core/DISET/private/Transports/SSLTransport.py index f893d80fb55..f5b42f03393 100755 --- a/src/DIRAC/Core/DISET/private/Transports/SSLTransport.py +++ b/src/DIRAC/Core/DISET/private/Transports/SSLTransport.py @@ -50,7 +50,7 @@ def checkSanity(urlTuple, kwargs): certFile = certTuple[0] useCerts = True elif "proxyString" in kwargs: - if not isinstance(kwargs["proxyString"], bytes): + if not isinstance(kwargs["proxyString"], str): gLogger.error("proxyString parameter is not a valid type", str(type(kwargs["proxyString"]))) return S_ERROR("proxyString parameter is not a valid type") else: