Skip to content

Commit 2e7a79a

Browse files
authored
Merge pull request #8131 from fstagni/90_use_server_cert_flag
[9.0] use server cert flag
2 parents 9b8773a + f25c4d0 commit 2e7a79a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/DIRAC/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,14 @@
5454
- getPlatformTuple(): DIRAC platform tuple for current host
5555
5656
"""
57-
import os
5857
import importlib.metadata
58+
import os
5959
import re
6060
import sys
61-
import warnings
61+
from collections.abc import Sequence
6262
from pkgutil import extend_path
6363
from typing import Any, Optional, Union
6464

65-
6665
__path__ = extend_path(__path__, __name__)
6766

6867
# Set the environment variable such that openssl accepts proxy cert
@@ -181,7 +180,7 @@ def initialize(
181180
log_level: Optional[LogLevel] = None,
182181
extra_config_files: Optional[list[os.PathLike]] = None,
183182
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,
185184
) -> None:
186185
"""Prepare the global state so that DIRAC clients can be used.
187186
@@ -227,9 +226,9 @@ def initialize(
227226

228227
if host_credentials:
229228
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]))
233232

234233
if log_level:
235234
gLogger.setLevel(log_level)

0 commit comments

Comments
 (0)