|
54 | 54 | - getPlatformTuple(): DIRAC platform tuple for current host
|
55 | 55 |
|
56 | 56 | """
|
57 |
| -import os |
58 | 57 | import importlib.metadata
|
| 58 | +import os |
59 | 59 | import re
|
60 | 60 | import sys
|
61 |
| -import warnings |
| 61 | +from collections.abc import Sequence |
62 | 62 | from pkgutil import extend_path
|
63 | 63 | from typing import Any, Optional, Union
|
64 | 64 |
|
65 |
| - |
66 | 65 | __path__ = extend_path(__path__, __name__)
|
67 | 66 |
|
68 | 67 | # Set the environment variable such that openssl accepts proxy cert
|
@@ -181,8 +180,7 @@ def initialize(
|
181 | 180 | log_level: Optional[LogLevel] = None,
|
182 | 181 | extra_config_files: Optional[list[os.PathLike]] = None,
|
183 | 182 | extra_config: Optional[dict[str, Any]] = None,
|
184 |
| - host_credentials: Optional[tuple[os.PathLike, os.PathLike]] = None, |
185 |
| - use_server_cert: bool = False, |
| 183 | + host_credentials: Optional[Union[Sequence[os.PathLike], bool]] = None, |
186 | 184 | ) -> None:
|
187 | 185 | """Prepare the global state so that DIRAC clients can be used.
|
188 | 186 |
|
@@ -226,13 +224,11 @@ def initialize(
|
226 | 224 | cfg.loadFromDict(extra_config)
|
227 | 225 | gConfigurationData.mergeWithLocal(cfg)
|
228 | 226 |
|
229 |
| - if use_server_cert: |
230 |
| - gConfigurationData.setOptionInCFG("/DIRAC/Security/UseServerCertificate", "yes") |
231 |
| - |
232 | 227 | if host_credentials:
|
233 | 228 | gConfigurationData.setOptionInCFG("/DIRAC/Security/UseServerCertificate", "yes")
|
234 |
| - gConfigurationData.setOptionInCFG("/DIRAC/Security/CertFile", str(host_credentials[0])) |
235 |
| - gConfigurationData.setOptionInCFG("/DIRAC/Security/KeyFile", str(host_credentials[1])) |
| 229 | + if isinstance(host_credentials, Sequence) and len(host_credentials) == 2: |
| 230 | + gConfigurationData.setOptionInCFG("/DIRAC/Security/CertFile", str(host_credentials[0])) |
| 231 | + gConfigurationData.setOptionInCFG("/DIRAC/Security/KeyFile", str(host_credentials[1])) |
236 | 232 |
|
237 | 233 | if log_level:
|
238 | 234 | gLogger.setLevel(log_level)
|
|
0 commit comments