diff --git a/docs/docs.conf b/docs/docs.conf index 1e7efef7575..870e5d28875 100644 --- a/docs/docs.conf +++ b/docs/docs.conf @@ -95,7 +95,7 @@ sectionPath = source/AdministratorGuide/CommandReference title = General information # [mandatory] pattern to match in the full path of the command names. -pattern = dirac-admin-service-ports, dirac-platform +pattern = dirac-platform # this list of patterns will reject scripts that are matched by the patterns above # exclude = user diff --git a/setup.cfg b/setup.cfg index 85469cada45..31e59d9390d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -205,7 +205,6 @@ console_scripts = dirac-admin-modify-user = DIRAC.Interfaces.scripts.dirac_admin_modify_user:main [admin] dirac-admin-pilot-summary = DIRAC.Interfaces.scripts.dirac_admin_pilot_summary:main [admin] dirac-admin-reset-job = DIRAC.Interfaces.scripts.dirac_admin_reset_job:main [admin] - dirac-admin-service-ports = DIRAC.Interfaces.scripts.dirac_admin_service_ports:main [admin] dirac-admin-set-site-protocols = DIRAC.Interfaces.scripts.dirac_admin_set_site_protocols:main [admin] dirac-admin-site-info = DIRAC.Interfaces.scripts.dirac_admin_site_info:main dirac-admin-site-mask-logging = DIRAC.Interfaces.scripts.dirac_admin_site_mask_logging:main [admin] diff --git a/src/DIRAC/Interfaces/API/DiracAdmin.py b/src/DIRAC/Interfaces/API/DiracAdmin.py index 51167069298..ee1be3e069f 100755 --- a/src/DIRAC/Interfaces/API/DiracAdmin.py +++ b/src/DIRAC/Interfaces/API/DiracAdmin.py @@ -258,65 +258,6 @@ def banSite(self, site, comment, printOutput=False): return result - ############################################################################# - def getServicePorts(self, setup="", printOutput=False): - """Checks the service ports for the specified setup. If not given this is - taken from the current installation (/DIRAC/Setup) - - Example usage: - - >>> gLogger.notice(diracAdmin.getServicePorts()) - {'OK': True, 'Value':''} - - :return: S_OK,S_ERROR - - """ - if not setup: - setup = gConfig.getValue("/DIRAC/Setup", "") - - setupList = gConfig.getSections("/DIRAC/Setups", []) - if not setupList["OK"]: - return S_ERROR("Could not get /DIRAC/Setups sections") - setupList = setupList["Value"] - if setup not in setupList: - return S_ERROR(f"Setup {setup} is not in allowed list: {', '.join(setupList)}") - - serviceSetups = gConfig.getOptionsDict(f"/DIRAC/Setups/{setup}") - if not serviceSetups["OK"]: - return S_ERROR(f"Could not get /DIRAC/Setups/{setup} options") - serviceSetups = serviceSetups["Value"] # dict - systemList = gConfig.getSections("/Systems") - if not systemList["OK"]: - return S_ERROR("Could not get Systems sections") - systemList = systemList["Value"] - result = {} - for system in systemList: - if system in serviceSetups: - path = f"/Systems/{system}/{serviceSetups[system]}/Services" - servicesList = gConfig.getSections(path) - if not servicesList["OK"]: - self.log.warn(f"Could not get sections in {path}") - else: - servicesList = servicesList["Value"] - if not servicesList: - servicesList = [] - self.log.verbose(f"System: {system} ServicesList: {', '.join(servicesList)}") - for service in servicesList: - spath = f"{path}/{service}/Port" - servicePort = gConfig.getValue(spath, 0) - if servicePort: - self.log.verbose(f"Found port for {system}/{service} = {servicePort}") - result[f"{system}/{service}"] = servicePort - else: - self.log.warn(f"No port found for {spath}") - else: - self.log.warn(f"{system} is not defined in /DIRAC/Setups/{setup}") - - if printOutput: - gLogger.notice(self.pPrint.pformat(result)) - - return S_OK(result) - ############################################################################# def getProxy(self, userDN, userGroup, validity=43200, limited=False): """Retrieves a proxy with default 12hr validity and stores diff --git a/src/DIRAC/Interfaces/scripts/dirac_admin_service_ports.py b/src/DIRAC/Interfaces/scripts/dirac_admin_service_ports.py deleted file mode 100755 index 4f2fcf439ba..00000000000 --- a/src/DIRAC/Interfaces/scripts/dirac_admin_service_ports.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python -######################################################################## -# File : dirac-admin-service-ports -# Author : Stuart Paterson -######################################################################## -""" -Print the service ports for the specified setup - -Example: - $ dirac-admin-service-ports - {'Framework/ProxyManager': 9152, - 'Framework/SystemAdministrator': 9162, - 'Framework/UserProfileManager': 9155, - 'WorkloadManagement/JobManager': 9132, - 'WorkloadManagement/PilotManager': 9171, - 'WorkloadManagement/Matcher': 9170, - 'WorkloadManagement/SandboxStore': 9196, - 'WorkloadManagement/WMSAdministrator': 9145} -""" -import DIRAC -from DIRAC.Core.Base.Script import Script - - -@Script() -def main(): - # Registering arguments will automatically add their description to the help menu - Script.registerArgument("Setup: Name of the setup", default="", mandatory=False) - Script.parseCommandLine(ignoreErrors=True) - setup = Script.getPositionalArgs(group=True) - - from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin - - diracAdmin = DiracAdmin() - result = diracAdmin.getServicePorts(setup, printOutput=True) - if result["OK"]: - DIRAC.exit(0) - else: - print(result["Message"]) - DIRAC.exit(2) - - -if __name__ == "__main__": - main()