Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions src/DIRAC/FrameworkSystem/Utilities/diracx.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
DEFAULT_TOKEN_CACHE_SIZE = 1024

legacy_exchange_session = requests.Session()
diracxUrl = gConfig.getValue("/DiracX/URL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a URL, or you break the pydantic check.

Probably:

Suggested change
diracxUrl = gConfig.getValue("/DiracX/URL")
diracxUrl = gConfig.getValue("/DiracX/URL", os.environ["DIRACX_URL"])

then inject one for the unit test.

legacy_exchange_session.verify = DiracxPreferences(url=diracxUrl).ca_path or 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