Skip to content

Commit

Permalink
fix: removed useless dirac_admin_service_ports.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Nov 19, 2024
1 parent 9a86dd5 commit fbbe658
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 104 deletions.
2 changes: 1 addition & 1 deletion docs/docs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
59 changes: 0 additions & 59 deletions src/DIRAC/Interfaces/API/DiracAdmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 0 additions & 43 deletions src/DIRAC/Interfaces/scripts/dirac_admin_service_ports.py

This file was deleted.

0 comments on commit fbbe658

Please sign in to comment.