Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/DIRAC/FrameworkSystem/Utilities/diracx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests
import os

from cachetools import TTLCache, LRUCache, cached
from cachetools.keys import hashkey
Expand Down Expand Up @@ -27,6 +28,8 @@
DEFAULT_TOKEN_CACHE_SIZE = 1024

legacy_exchange_session = requests.Session()
# Get CA's location from DIRACX_CA_PATH if defined or from the standard location
legacy_exchange_session.verify = os.environ.get("DIRACX_CA_PATH", True)


def get_token(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def _getFromClient(self, fileId, token, fileSize, fileHelper=None, data=""):
gLogger.debug("Uploading sandbox for", res.pfn)
files = {"file": ("file", tar_fh)}

response = requests.post(res.url, data=res.fields, files=files, timeout=300)
verify = os.environ.get("DIRACX_CA_PATH", True)
response = requests.post(res.url, data=res.fields, files=files, timeout=300, verify=verify)

gLogger.debug("Sandbox uploaded", f"for {res.pfn} with status code {response.status_code}")
# TODO: Handle this error better
Expand Down Expand Up @@ -371,7 +372,8 @@ def _sendToClient(self, fileID, token, fileHelper=None, raw=False):
if filePath.startswith("/S3"):
with TheImpersonator(credDict, source="SandboxStore") as client:
res = client.jobs.get_sandbox_file(pfn=filePath)
r = requests.get(res.url)
verify = os.environ.get("DIRACX_CA_PATH", True)
r = requests.get(res.url, verify=verify)
r.raise_for_status()
sbData = r.content
if fileHelper:
Expand Down
Loading