Exemplo n.º 1
0
modified = False

for arg in args:
  value = None
  section = None
  option = None
  if "=" in arg:
    arg, value = arg.split( "=" )
  if "." in arg:
    section, option = arg.split( "." )
  else:
    section = arg

  if value != None:
    dconfig.set( section, option, value )
    modified = True
  else:
    retVal = dconfig.get( section, option )
    if not retVal[ "OK" ]: critical( retVal[ "Message" ] )
    ret = retVal[ "Value" ]
    if type( ret ) == type( [ ] ):
      print "[%s]" % section
      for o, v in ret:
        print o, "=", v
    else:
      print option, "=", ret

if modified:
  dconfig.write( )
Exemplo n.º 2
0
Script.registerSwitch("m", "minimal", "verify and fill minimal configuration", params.setMinimal)

Script.disableCS()

Script.parseCommandLine(ignoreErrors=True)
args = Script.getPositionalArgs()

if params.minimal:
    createMinimalConfig()

dconfig = DConfig()

if not args:
    sections = dconfig.sections()
    for s in sections:
        retVal = dconfig.get(s, None)
        if not retVal["OK"]:
            critical(retVal["Message"])

        print "[%s]" % s
        for o, v in retVal["Value"]:
            print o, "=", v
        print
    DIRAC.exit(0)


modified = False

for arg in args:
    value = None
    section = None