CSAPI

CSAPI exposes update functionalities to the Configuration.

Most of these functions can only be done by administrators

class DIRAC.ConfigurationSystem.Client.CSAPI.CSAPI

Bases: object

CSAPI objects need an initialization phase

addGroup(groupname, properties)

Add a group to the cs

param str groupname:
 

group name

param dict properties:
 

dictionary describing group properties:

  • Users
  • Properties
  • <extra params>
return:

True/False

addHost(hostname, properties)
Add a host to the cs
param str hostname:
 

hostname name

param dict properties:
 

dictionary describing host properties:

  • DN
  • Properties
  • <extra params>
return:

True/False

addShifter(shifters=None)

Adds or modify one or more shifters. Also, adds the shifter section in case this is not present. Shifter identities are used in several places, mostly for running agents

shifters should be in the form {‘ShifterRole’:{‘User’:’aUserName’, ‘Group’:’aDIRACGroup’}}

Returns:S_OK/S_ERROR
addUser(username, properties)

Add a user to the cs

param str username:
 

group name

param dict properties:
 

dictionary describing user properties:

  • DN
  • groups
  • <extra params>
return:

True/False

checkForUnexistantUsersInGroups()
commit()

Commit the accumulated changes to the CS server

commitChanges(sortUsers=True)
copySection(originalPath, targetPath)

Copy a whole section to a new location

createSection(sectionPath, comment='')

Create a new section

delOption(optionPath)

Delete an option

delSection(sectionPath)

Delete a section

deleteUsers(users)

Delete a user/s can receive as a param either a string or a list

describeGroups(mask=None)

List all groups that are in the mask (or all if no mask) with their properties

describeHosts(hosts=None)
describeUsers(users=None)
downloadCSData()
getCurrentCFG()

Get the current CFG as it is

initialize()
listGroups()

List all groups

listHosts()
listUsers(group=False)
mergeCFGUnderSection(sectionPath, cfg)

Merge the given cfg under a certain section

mergeFromCFG(cfg)

Merge the internal CFG data with the input

mergeWithCFG(cfg)

Merge the given cfg with the current config

modifyGroup(groupname, properties, createIfNonExistant=False)

Modify a group

param str groupname:
 

group name

param dict properties:
 

dictionary describing group properties:

  • Users
  • Properties
  • <extra params>
return:

True/False

modifyHost(hostname, properties, createIfNonExistant=False)
Modify a host
param str hostname:
 

hostname name

param dict properties:
 

dictionary describing host properties:

  • DN
  • Properties
  • <extra params>
return:

True/False

modifyUser(username, properties, createIfNonExistant=False)

Modify a user

param str username:
 

group name

param dict properties:
 

dictionary describing user properties:

  • DN
  • Groups
  • <extra params>
return:

S_OK, Value = True/False

modifyValue(optionPath, newValue)

Modify an existing value at the specified options path.

moveSection(originalPath, targetPath)

Move a whole section to a new location

setOption(optionPath, optionValue)

Create an option at the specified path.

setOptionComment(optionPath, comment)

Create an option at the specified path.

showDiff()

Just shows the differences accumulated within the Modificator object

sortUsersAndGroups()
syncUsersWithCFG(usersCFG)

Sync users with the cfg contents. Usernames have to be sections containing DN, Groups, and extra properties as parameters