本文整理汇总了Python中DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI.getCurrentCFG方法的典型用法代码示例。如果您正苦于以下问题:Python CSAPI.getCurrentCFG方法的具体用法?Python CSAPI.getCurrentCFG怎么用?Python CSAPI.getCurrentCFG使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI
的用法示例。
在下文中一共展示了CSAPI.getCurrentCFG方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestComponentInstallation
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI import getCurrentCFG [as 别名]
class TestComponentInstallation( unittest.TestCase ):
"""
Contains methods for testing of separate elements
"""
def setUp( self ):
self.host = 'localhost'
self.notificationPort = 9154
self.rootPwd = ''
self.csClient = CSAPI()
self.monitoringClient = ComponentMonitoringClient()
self.client = SystemAdministratorClientCLI( self.host )
self.csClient.downloadCSData()
result = self.csClient.getCurrentCFG()
if not result[ 'OK' ]:
raise Exception( result[ 'Message' ] )
cfg = result[ 'Value' ]
setup = cfg.getOption( 'DIRAC/Setup', 'JenkinsSetup' )
self.frameworkSetup = cfg.getOption( 'DIRAC/Setups/' + setup + '/Framework' )
self.rootPwd = cfg.getOption( 'Systems/Databases/Password' )
self.diracPwd = self.rootPwd
def tearDown( self ):
pass
示例2: TestComponentInstallation
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI import getCurrentCFG [as 别名]
class TestComponentInstallation(unittest.TestCase):
"""
Contains methods for testing of separate elements
"""
def setUp(self):
self.host = 'localhost'
self.notificationPort = 9154
self.rootPwd = ''
self.csClient = CSAPI()
self.monitoringClient = ComponentMonitoringClient()
self.client = SystemAdministratorClientCLI(self.host)
self.csClient.downloadCSData()
result = self.csClient.getCurrentCFG()
if not result['OK']:
raise Exception(result['Message'])
cfg = result['Value']
setup = cfg.getOption('DIRAC/Setup', 'dirac-JenkinsSetup')
self.frameworkSetup = cfg.getOption('DIRAC/Setups/' + setup + '/Framework')
self.rootPwd = cfg.getOption('Systems/Databases/Password')
self.diracPwd = self.rootPwd
result = getProxyInfo()
if not result['OK']:
raise Exception(result['Message'])
chain = result['Value']['chain']
result = chain.getCertInChain(-1)
if not result['OK']:
raise Exception(result['Message'])
result = result['Value'].getSubjectDN()
if not result['OK']:
raise Exception(result['Message'])
userDN = result['Value']
result = getUsernameForDN(userDN)
if not result['OK']:
raise Exception(result['Message'])
self.user = result['Value']
if not self.user:
self.user = 'unknown'
def tearDown(self):
pass
示例3: str
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI import getCurrentCFG [as 别名]
module = \
str( rDict[ compType ][ system ][ component ][ 'Module' ] )
record[ 'Component' ][ 'System' ] = system
record[ 'Component' ][ 'Module' ] = module
# Transform 'Services' into 'service', 'Agents' into 'agent' ...
record[ 'Component' ][ 'Type' ] = compType.lower()[ :-1 ]
record[ 'Host' ][ 'HostName' ] = host
record[ 'Host' ][ 'CPU' ] = cpu
record[ 'Installation' ][ 'Instance' ] = component
record[ 'Installation' ][ 'InstallationTime' ] = datetime.utcnow()
record[ 'Installation' ][ 'InstalledBy' ] = user
records.append( record )
# Databases
csClient = CSAPI()
cfg = csClient.getCurrentCFG()[ 'Value' ]
if hasMySQL:
allDB = allDBResult[ 'Value' ]
availableDB = availableDBResult[ 'Value' ]
for db in allDB:
# Check for DIRAC only databases
if db in availableDB.keys() and db != 'InstalledComponentsDB':
# Check for 'installed' databases
isSection = cfg.isSection \
( 'Systems/' + availableDB[ db ][ 'System' ] + '/' +
cfg.getOption( 'DIRAC/Setups/' + setup + '/' +
availableDB[ db ][ 'System' ] ) + '/Databases/' + db +
'/' )
if isSection:
示例4: getProxyInfo
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI import getCurrentCFG [as 别名]
result = getProxyInfo()
if not result["OK"]:
gLogger.error("Failed to get proxy information", result["Message"])
DIRAC.exit(2)
proxy = result["Value"]
if proxy["secondsLeft"] < 1:
gLogger.error("Your proxy has expired, please create new one")
DIRAC.exit(2)
group = proxy["group"]
if not "CSAdministrator" in getPropertiesForGroup(group):
gLogger.error("You must be CSAdministrator user to execute this script")
gLogger.notice("Please issue 'dirac-proxy-init -g [group with CSAdministrator Property]'")
DIRAC.exit(2)
cs = CSAPI()
result = cs.getCurrentCFG()
if not result["OK"]:
gLogger.error("Failed to get copy of CS", result["Message"])
DIRAC.exit(2)
cfg = result["Value"]
if not cfg.isSection("Resources"):
gLogger.error("Section '/Resources' is absent in CS")
DIRAC.exit(2)
if not cfg.isSection("Resources/Sites"):
gLogger.error("Subsection '/Resources/Sites' is absent in CS")
DIRAC.exit(2)
if args and len(args) > 0:
示例5: convertSites
# 需要导入模块: from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI [as 别名]
# 或者: from DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI import getCurrentCFG [as 别名]
siteName = result['Value']
gLogger.notice( 'Processing CondDB endpoint at site %s' % siteName )
csapi.copySection( '/Resources/CondDB/%s' % site,
'%s/Sites/%s/DBServer/CondDB' % (RESOURCES_NEW_SECTION,siteName) )
csapi.setOptionComment( '%s/Sites/%s/DBServer' % (RESOURCES_NEW_SECTION,siteName),
'Database server resource' )
csapi.setOptionComment( '%s/Sites/%s/DBServer/CondDB' % (RESOURCES_NEW_SECTION,siteName),
'Conditions database' )
if __name__ == '__main__':
if computingFlag:
result = convertSites()
if storageFlag:
result = convertSEs()
if catalogFlag:
result = convertCatalogs()
if transferFlag:
result = convertTransfers()
if dbFlag:
result = convertDBServers()
csapi.commitChanges()
print csapi.getCurrentCFG()['Value'].serialize()