本文整理匯總了Python中DIRAC.ConfigurationSystem.private.Modificator.Modificator.mergeFromCFG方法的典型用法代碼示例。如果您正苦於以下問題:Python Modificator.mergeFromCFG方法的具體用法?Python Modificator.mergeFromCFG怎麽用?Python Modificator.mergeFromCFG使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DIRAC.ConfigurationSystem.private.Modificator.Modificator
的用法示例。
在下文中一共展示了Modificator.mergeFromCFG方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from DIRAC.ConfigurationSystem.private.Modificator import Modificator [as 別名]
# 或者: from DIRAC.ConfigurationSystem.private.Modificator.Modificator import mergeFromCFG [as 別名]
#.........這裏部分代碼省略.........
for user in usersInGroup:
if user in allUsers:
filteredUsers.append( user )
self.__csMod.setOptionValue( "%s/Groups/%s/Users" % ( self.__baseSecurity, group ),
",".join( filteredUsers ) )
def commitChanges( self, sortUsers = True ):
if not self.__initialized[ 'OK' ]:
return self.__initialized
if self.__csModified:
self.checkForUnexistantUsersInGroups()
if sortUsers:
self.sortUsersAndGroups()
retVal = self.__csMod.commit()
if not retVal[ 'OK' ]:
gLogger.error( "Can't commit new data: %s" % retVal[ 'Message' ] )
return retVal
return self.downloadCSData()
return S_OK()
def commit( self ):
""" Commit the accumulated changes to the CS server
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
if self.__csModified:
retVal = self.__csMod.commit()
if not retVal[ 'OK' ]:
gLogger.error( "Can't commit new data: %s" % retVal[ 'Message' ] )
return retVal
return self.downloadCSData()
return S_OK()
def mergeFromCFG( self, cfg ):
""" Merge the internal CFG data with the input
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
self.__csMod.mergeFromCFG( cfg )
self.__csModified = True
return S_OK()
def modifyValue( self, optionPath, newValue ):
"""Modify an existing value at the specified options path.
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
prevVal = self.__csMod.getValue( optionPath )
if not prevVal:
return S_ERROR( 'Trying to set %s to %s but option does not exist' % ( optionPath, newValue ) )
gLogger.verbose( "Changing %s from \n%s \nto \n%s" % ( optionPath, prevVal, newValue ) )
self.__csMod.setOptionValue( optionPath, newValue )
self.__csModified = True
return S_OK( 'Modified %s' % optionPath )
def setOption( self, optionPath, optionValue ):
"""Create an option at the specified path.
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
self.__csMod.setOptionValue( optionPath, optionValue )
self.__csModified = True
return S_OK( 'Created new option %s = %s' % ( optionPath, optionValue ) )
def setOptionComment( self, optionPath, comment ):
示例2: CSAPI
# 需要導入模塊: from DIRAC.ConfigurationSystem.private.Modificator import Modificator [as 別名]
# 或者: from DIRAC.ConfigurationSystem.private.Modificator.Modificator import mergeFromCFG [as 別名]
#.........這裏部分代碼省略.........
for user in usersInGroup:
if user in allUsers:
filteredUsers.append( user )
self.__csMod.setOptionValue( "%s/Groups/%s/Users" % ( self.__baseSecurity, group ),
",".join( filteredUsers ) )
def commitChanges( self, sortUsers = True ):
if not self.__initialized[ 'OK' ]:
return self.__initialized
if self.csModified:
self.checkForUnexistantUsersInGroups()
if sortUsers:
self.sortUsersAndGroups()
retVal = self.__csMod.commit()
if not retVal[ 'OK' ]:
gLogger.error( "Can't commit new configuration data", "%s" % retVal[ 'Message' ] )
return retVal
return self.downloadCSData()
return S_OK()
def commit( self ):
""" Commit the accumulated changes to the CS server
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
if self.csModified:
retVal = self.__csMod.commit()
if not retVal[ 'OK' ]:
gLogger.error( "Can't commit new configuration data", "%s" % retVal[ 'Message' ] )
return retVal
return self.downloadCSData()
return S_OK()
def mergeFromCFG( self, cfg ):
""" Merge the internal CFG data with the input
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
self.__csMod.mergeFromCFG( cfg )
self.csModified = True
return S_OK()
def modifyValue( self, optionPath, newValue ):
"""Modify an existing value at the specified options path.
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
prevVal = self.__csMod.getValue( optionPath )
if prevVal is None:
return S_ERROR( 'Trying to set %s to %s but option does not exist' % ( optionPath, newValue ) )
gLogger.verbose( "Changing %s from \n%s \nto \n%s" % ( optionPath, prevVal, newValue ) )
self.__csMod.setOptionValue( optionPath, newValue )
self.csModified = True
return S_OK( 'Modified %s' % optionPath )
def setOption( self, optionPath, optionValue ):
"""Create an option at the specified path.
"""
if not self.__initialized[ 'OK' ]:
return self.__initialized
self.__csMod.setOptionValue( optionPath, optionValue )
self.csModified = True
return S_OK( 'Created new option %s = %s' % ( optionPath, optionValue ) )
def setOptionComment( self, optionPath, comment ):