diff --git a/docs/source/AdministratorGuide/HowTo/SystemAdministratorInterface.rst b/docs/source/AdministratorGuide/HowTo/SystemAdministratorInterface.rst index 2ba901e9281..9fafbb5e849 100644 --- a/docs/source/AdministratorGuide/HowTo/SystemAdministratorInterface.rst +++ b/docs/source/AdministratorGuide/HowTo/SystemAdministratorInterface.rst @@ -267,4 +267,4 @@ For example:: update 9.0.18 update integration - update 'DIRAC[server] @ git+https://github.com/fstagni/DIRAC.git@test_branch' + update DIRAC[server] @ git+https://github.com/fstagni/DIRAC.git@test_branch diff --git a/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py b/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py index 9b65a237518..902daa61d92 100644 --- a/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py +++ b/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py @@ -1,6 +1,6 @@ #!/usr/bin/env python ######################################################################## -""" System Administrator Client Command Line Interface """ +"""System Administrator Client Command Line Interface""" import atexit import datetime @@ -1066,16 +1066,9 @@ def do_update(self, args): update """ - try: - version = args.split()[0] - except Exception as x: - gLogger.notice("ERROR: wrong input:", str(x)) - gLogger.notice(self.do_update.__doc__) - return - client = SystemAdministratorClient(self.host, self.port) gLogger.notice("Software update can take a while, please wait ...") - result = client.updateSoftware(version, timeout=600) + result = client.updateSoftware(args, timeout=600) if not result["OK"]: self._errMsg("Failed to update the software") gLogger.notice(result["Message"]) diff --git a/src/DIRAC/FrameworkSystem/Service/SystemAdministratorHandler.py b/src/DIRAC/FrameworkSystem/Service/SystemAdministratorHandler.py index 24c1cf837c0..9aa85b3bc75 100644 --- a/src/DIRAC/FrameworkSystem/Service/SystemAdministratorHandler.py +++ b/src/DIRAC/FrameworkSystem/Service/SystemAdministratorHandler.py @@ -1,34 +1,33 @@ """SystemAdministrator service is a tool to control and monitor the DIRAC services and agents""" -import socket -import os -import re -import time import getpass import importlib -import shutil +import os import platform -import tempfile +import re +import shutil +import socket import subprocess +import tempfile +import time from datetime import datetime, timedelta -import requests import psutil -from packaging.version import Version, InvalidVersion - +import requests from diraccfg import CFG +from packaging.version import InvalidVersion, Version -from DIRAC import S_OK, S_ERROR, gConfig, rootPath, gLogger, convertToPy3VersionNumber +from DIRAC import S_ERROR, S_OK, convertToPy3VersionNumber, gConfig, gLogger, rootPath +from DIRAC.ConfigurationSystem.Client import PathFinder from DIRAC.Core.DISET.RequestHandler import RequestHandler +from DIRAC.Core.Security.Locations import getHostCertificateAndKeyLocation +from DIRAC.Core.Security.X509Chain import X509Chain # pylint: disable=import-error from DIRAC.Core.Utilities import Os from DIRAC.Core.Utilities.Extensions import extensionsByPriority, getExtensionMetadata from DIRAC.Core.Utilities.File import mkLink -from DIRAC.Core.Utilities.TimeUtilities import fromString, hour, day from DIRAC.Core.Utilities.Subprocess import shellCall from DIRAC.Core.Utilities.ThreadScheduler import gThreadScheduler -from DIRAC.Core.Security.Locations import getHostCertificateAndKeyLocation -from DIRAC.Core.Security.X509Chain import X509Chain # pylint: disable=import-error -from DIRAC.ConfigurationSystem.Client import PathFinder +from DIRAC.Core.Utilities.TimeUtilities import day, fromString, hour from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller from DIRAC.FrameworkSystem.Client.ComponentMonitoringClient import ComponentMonitoringClient @@ -311,7 +310,7 @@ def export_updateSoftware(self, version): installer.flush() self.log.info("Downloaded DIRACOS installer to", installer.name) - directory = version if released_version else version.split("@")[1].split("#")[0] + directory = version if released_version else version.split()[2].split("@")[1].split("#")[0] newProPrefix = os.path.join( rootPath, "versions",