diff --git a/integration_tests.py b/integration_tests.py index 057dcd0fade..03fdd00fa46 100755 --- a/integration_tests.py +++ b/integration_tests.py @@ -34,7 +34,10 @@ "DIRAC_USE_JSON_ENCODE": None, "INSTALLATION_BRANCH": "", } -DIRACX_OPTIONS = ("DIRAC_ENABLE_DIRACX_JOB_MONITORING",) +DIRACX_OPTIONS = ( + "DIRAC_ENABLE_DIRACX_LOGIN", + "DIRAC_ENABLE_DIRACX_JOB_MONITORING", +) DEFAULT_MODULES = {"DIRAC": Path(__file__).parent.absolute()} # Static configuration diff --git a/src/DIRAC/FrameworkSystem/Service/ProxyManagerHandler.py b/src/DIRAC/FrameworkSystem/Service/ProxyManagerHandler.py index 8d0b8555f22..fc2acca1313 100644 --- a/src/DIRAC/FrameworkSystem/Service/ProxyManagerHandler.py +++ b/src/DIRAC/FrameworkSystem/Service/ProxyManagerHandler.py @@ -411,7 +411,11 @@ def export_getVOMSProxyWithToken(self, userDN, userGroup, requestPem, requiredLi def export_exchangeProxyForToken(self): try: - from diracx.routers.auth import AuthSettings, create_access_token, TokenResponse + from diracx.routers.auth import ( + AuthSettings, + create_access_token, + TokenResponse, + ) # pylint: disable=import-error authSettings = AuthSettings() diff --git a/src/DIRAC/FrameworkSystem/scripts/dirac_login.py b/src/DIRAC/FrameworkSystem/scripts/dirac_login.py index 655d072fae8..88dd356e29d 100644 --- a/src/DIRAC/FrameworkSystem/scripts/dirac_login.py +++ b/src/DIRAC/FrameworkSystem/scripts/dirac_login.py @@ -318,8 +318,10 @@ def loginWithCertificate(self): return res # Get a token for use with diracx - res = Client(url="Framework/ProxyManager").exchangeProxyForToken() - if res["OK"]: + if os.getenv("DIRAC_ENABLE_DIRACX_LOGIN", "No").lower() in ("yes", "true"): + res = Client(url="Framework/ProxyManager").exchangeProxyForToken() + if not res["OK"]: + return res DIRAC_TOKEN_FILE.parent.mkdir(parents=True, exist_ok=True) expires = datetime.datetime.now(tz=datetime.timezone.utc) + datetime.timedelta( seconds=res["Value"]["expires_in"] - EXPIRES_GRACE_SECONDS @@ -331,8 +333,7 @@ def loginWithCertificate(self): "expires": expires.isoformat(), } DIRAC_TOKEN_FILE.write_text(json.dumps(credential_data)) - else: - gLogger.warn(res["Message"]) + return S_OK() def __enableCS(self): diff --git a/src/DIRAC/FrameworkSystem/scripts/dirac_proxy_init.py b/src/DIRAC/FrameworkSystem/scripts/dirac_proxy_init.py index 9da537c52b1..6fabcace1a9 100755 --- a/src/DIRAC/FrameworkSystem/scripts/dirac_proxy_init.py +++ b/src/DIRAC/FrameworkSystem/scripts/dirac_proxy_init.py @@ -244,9 +244,10 @@ def doTheMagic(self): if self.__piParams.strict: return resultProxyUpload - # res = Client(url="dips://lhcbvoboxcertif00.cern.ch:9152/Framework/ProxyManager").exchangeProxyForToken() - res = Client(url="Framework/ProxyManager").exchangeProxyForToken() - if res["OK"]: + if os.getenv("DIRAC_ENABLE_DIRACX_LOGIN", "No").lower() in ("yes", "true"): + res = Client(url="Framework/ProxyManager").exchangeProxyForToken() + if not res["OK"]: + return res DIRAC_TOKEN_FILE.parent.mkdir(parents=True, exist_ok=True) expires = datetime.datetime.now(tz=datetime.timezone.utc) + datetime.timedelta( seconds=res["Value"]["expires_in"] - EXPIRES_GRACE_SECONDS @@ -258,8 +259,6 @@ def doTheMagic(self): "expires": expires.isoformat(), } DIRAC_TOKEN_FILE.write_text(json.dumps(credential_data)) - else: - gLogger.warn(res["Message"]) return S_OK() diff --git a/src/DIRAC/WorkloadManagementSystem/FutureClient/JobMonitoringClient.py b/src/DIRAC/WorkloadManagementSystem/FutureClient/JobMonitoringClient.py index ad980666c6e..5759a8e7fed 100644 --- a/src/DIRAC/WorkloadManagementSystem/FutureClient/JobMonitoringClient.py +++ b/src/DIRAC/WorkloadManagementSystem/FutureClient/JobMonitoringClient.py @@ -1,3 +1,4 @@ +# pylint: disable=import-error from diracx.client import Dirac from diracx.client.models import JobSearchParams