Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ConfigurationSystem/Client/Helpers/Operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Operations( object ):

__cache = {}
__cacheVersion = 0
__cacheLock = LockRing.LockRing().getLock( "CSOperations.cache" )
__cacheLock = LockRing.LockRing().getLock()

def __init__( self, vo = False, group = False, setup = False ):
self.__uVO = vo
Expand Down
32 changes: 19 additions & 13 deletions ConfigurationSystem/Client/Helpers/Registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,31 @@ def getDNForUsername( username ):
return S_OK( dnList )
return S_ERROR( "No DN found for user %s" % username )

def getGroupsForUser( username ):
def getGroupsForDN( dn ):
retVal = getUsernameForDN( dn )
if not retVal[ 'OK' ]:
return retVal
return getGroupsForUser( retVal[ 'Value' ] )

def __getGroupsWithProperty( property,value ):
retVal = gConfig.getSections( "%s/Groups" % gBaseSecuritySection )
if not retVal[ 'OK' ]:
return retVal
groupsList = retVal[ 'Value' ]
userGroups = []
groups = []
for group in groupsList:
if username in gConfig.getValue( "%s/Groups/%s/Users" % ( gBaseSecuritySection, group ), [] ):
userGroups.append( group )
if not userGroups:
return S_ERROR( "No groups found for user %s" % username )
userGroups.sort()
return S_OK( userGroups )
if value in gConfig.getValue( "%s/Groups/%s/%s" % ( gBaseSecuritySection, group, property ), [] ):
groups.append( group )
if not groups:
return S_ERROR( "No groups found for %s=%s" % ( property,value ) )
groups.sort()
return S_OK( groups )

def getGroupsForDN( dn ):
retVal = getUsernameForDN( dn )
if not retVal[ 'OK' ]:
return retVal
return getGroupsForUser( retVal[ 'Value' ] )
def getGroupsForUser( username ):
return __getGroupsWithProperty( 'Users',username )

def getGroupsForVO( vo ):
return __getGroupsWithProperty( 'VO',vo )

def getHostnameForDN( dn ):
retVal = gConfig.getSections( "%s/Hosts" % gBaseSecuritySection )
Expand Down
64 changes: 64 additions & 0 deletions ConfigurationSystem/Client/Helpers/Resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,70 @@ def getStorageElementOptions( seName ):

return S_OK( options )

def getQueues( siteList=None, ceList=None, ceTypeList=None, community=None, mode=None ):
""" Get CE/queue options according to the specified selection
"""

result = gConfig.getSections('/Resources/Sites')
if not result['OK']:
return result

resultDict = {}

grids = result['Value']
for grid in grids:
result = gConfig.getSections( '/Resources/Sites/%s' % grid )
if not result['OK']:
continue
sites = result['Value']
for site in sites:
if siteList is not None and not site in siteList:
continue
if community:
comList = gConfig.getValue( '/Resources/Sites/%s/%s/VO' % (grid,site), [] )
if comList and not community in comList:
continue
result = gConfig.getSections( '/Resources/Sites/%s/%s/CEs' % (grid,site) )
if not result['OK']:
continue
ces = result['Value']
for ce in ces:
if mode:
ceMode = gConfig.getValue( '/Resources/Sites/%s/%s/CEs/%s/SubmissionMode' % (grid,site,ce), 'InDirect' )
if not ceMode or ceMode != mode:
continue
if ceTypeList:
ceType = gConfig.getValue( '/Resources/Sites/%s/%s/CEs/%s/CEType' % (grid,site,ce), None )
if not ceType or not ceType in ceTypeList:
continue
if community:
comList = gConfig.getValue( '/Resources/Sites/%s/%s/CEs/%s/VO' % (grid,site,ce), [] )
if comList and not community in comList:
continue
result = gConfig.getOptionsDict( '/Resources/Sites/%s/%s/CEs/%s' % (grid,site,ce) )
if not result['OK']:
continue
ceOptionsDict = result['Value']
result = gConfig.getSections( '/Resources/Sites/%s/%s/CEs/%s/Queues' % (grid,site,ce) )
if not result['OK']:
continue
queues = result['Value']
for queue in queues:
if community:
comList = gConfig.getValue( '/Resources/Sites/%s/%s/CEs/%s/Queues/%s/VO' % (grid,site,ce,queue), [] )
if comList and not community in comList:
continue
resultDict.setdefault(site,{})
resultDict[site].setdefault(ce,ceOptionsDict)
resultDict[site][ce].setdefault('Queues',{})
result = gConfig.getOptionsDict( '/Resources/Sites/%s/%s/CEs/%s/Queues/%s' % (grid,site,ce,queue) )
if not result['OK']:
continue
queueOptionsDict = result['Value']
resultDict[site][ce]['Queues'][queue] = queueOptionsDict

return S_OK(resultDict)

def getCatalogPath(catalogName):
""" Return the configuration path of the description for a a given catalog
"""
Expand Down
4 changes: 2 additions & 2 deletions ConfigurationSystem/private/ConfigurationData.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class ConfigurationData:

def __init__( self, loadDefaultCFG = True ):
lr = LockRing()
self.threadingEvent = lr.getEvent( "configdata.dangerZone" )
self.threadingEvent = lr.getEvent()
self.threadingEvent.set()
self.threadingLock = lr.getLock( "configdata.update" )
self.threadingLock = lr.getLock()
self.runningThreadsNumber = 0
self.compressedConfigurationData = ""
self.configurationPath = "/DIRAC/Configuration"
Expand Down
2 changes: 1 addition & 1 deletion ConfigurationSystem/private/Refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__( self ):
self.__callbacks = { 'newVersion' : [] }
gEventDispatcher.registerEvent( "CSNewVersion" )
random.seed()
self.__triggeredRefreshLock = LockRing.LockRing().getLock( "Refresher.triggerUpdate" )
self.__triggeredRefreshLock = LockRing.LockRing().getLock()

def disable( self ):
self.__refreshEnabled = False
Expand Down
2 changes: 1 addition & 1 deletion Core/DISET/private/GatewayService.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def forwardListBulk( self, clientFileHelper, params ):
class MessageForwarder:

def __init__( self, msgBroker ):
self.__inOutLock = LockRing().getLock( "DISET.MsgFwd.IO" )
self.__inOutLock = LockRing().getLock()
self.__msgBroker = msgBroker
self.__byClient = {}
self.__srvToCliTrid = {}
Expand Down
4 changes: 2 additions & 2 deletions Core/DISET/private/Transports/SSL/SocketInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SocketInfo:

__cachedCAsCRLs = False
__cachedCAsCRLsLastLoaded = 0
__cachedCAsCRLsLoadLock = LockRing().getLock( "DISET.SocketInfo.CAs" )
__cachedCAsCRLsLoadLock = LockRing().getLock()


def __init__( self, infoDict, sslContext = False ):
Expand Down Expand Up @@ -162,7 +162,7 @@ def __getCAStore( self ):
if fileName.find( ".0" ) == len( fileName ) - 2:
gLogger.exception( "LOADING %s" % filePath )
if 'IgnoreCRLs' not in self.infoDict or not self.infoDict[ 'IgnoreCRLs' ]:
#Try to load CRL
#Try to load CRL
try:
crl = GSI.crypto.load_crl( GSI.crypto.FILETYPE_PEM, pemData )
if crl.has_expired():
Expand Down
2 changes: 1 addition & 1 deletion Core/DISET/private/Transports/SSL/ThreadSafeSSLObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from DIRAC.FrameworkSystem.Client.Logger import gLogger

class ThreadSafeSSLObject:
cLock = LockRing().getLock( "DISET.TSSSLObj" )
cLock = LockRing().getLock()
def __init__( self, object ):
self.cObject = object
def __getattr__( self, name ):
Expand Down
2 changes: 1 addition & 1 deletion Core/DISET/private/Transports/SSLTransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class SSLTransport( BaseTransport ):

__readWriteLock = LockRing().getLock( "DISET.SSLTrans.RW" )
__readWriteLock = LockRing().getLock()

def __init__( self, *args, **kwargs ):
self.__writesDone = 0
Expand Down
Loading