|
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,7 +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, |
| 183 | + host_credentials: Optional[Union[Sequence[os.PathLike], bool]] = None, |
185 | 184 | ) -> None:
|
186 | 185 | """Prepare the global state so that DIRAC clients can be used.
|
187 | 186 |
|
@@ -227,9 +226,9 @@ def initialize(
|
227 | 226 |
|
228 | 227 | if host_credentials:
|
229 | 228 | gConfigurationData.setOptionInCFG("/DIRAC/Security/UseServerCertificate", "yes")
|
230 |
| - if isinstance(host_credentials, tuple): |
231 |
| - gConfigurationData.setOptionInCFG("/DIRAC/Security/CertFile", str(host_credentials[0])) |
232 |
| - 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])) |
233 | 232 |
|
234 | 233 | if log_level:
|
235 | 234 | gLogger.setLevel(log_level)
|
|
0 commit comments