mongo/buildscripts/resmokelib/utils/certs.py
Gabriel Marks 77d90a66d3 SERVER-99750 Use generated certificates in jstests (#46650)
GitOrigin-RevId: 303ffa3be9ec56f70a9ff9e38d4430fd0c927599
2026-01-28 18:44:45 +00:00

24 lines
685 B
Python

import os
from buildscripts.resmokelib import config
def _get_x509_basepath():
return (
"x509"
if config.INSTALL_DIR is None or config.INSTALL_DIR == ""
else os.path.join(config.INSTALL_DIR, "x509")
)
def expand_x509_paths(options: dict) -> dict:
"""Shallowly replace any references to ${x509ObjDir} in option values with the real directory
containing x509 certificates for testing."""
new_options = {}
for k, v in options.items():
if type(v) == str and r"${x509ObjDir}" in v:
new_options[k] = v.replace(r"${x509ObjDir}", _get_x509_basepath())
else:
new_options[k] = v
return new_options