Esempio n. 1
0
    fccli.do_meta( "show" )
    DIRAC.exit( 0 )

  meta_commands = {
    "add" : DMetaAdd( fccli ),
    "rm" : DMetaRm( fccli ),
    "ls" : DMetaList( catalog )
    }

  if len( args ) < 2:
    print "Error: Not enough arguments provided\n%s:" % Script.scriptName
    Script.showHelp( )
    DIRAC.exit( -1 )

  command = args[ 0 ]

  if command not in meta_commands.keys( ):
    print "Error: Unknown dmeta command \"%s\"" % command
    print "%s:" % Script.scriptName
    Script.showHelp( )
    DIRAC.exit( -1 )


  command = meta_commands[ command ]

  lfn = pathFromArgument( session, args[ 1 ] )

  metas = args[ 2: ]

  command.run( lfn, metas )
Esempio n. 2
0
                        )


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

session = DSession( )
catalog = DCatalog( )

if len( args ) < 1:
  print "\nError: not enough arguments provided\n%s:" % Script.scriptName
  Script.showHelp( )
  DIRAC.exit( -1 )

# lfn
lfn = pathFromArgument( session, args[ 0 ] )

# default local_path: same file name as lfn.
local_path = os.path.basename( lfn )
# STRANGE: dirac only accepts directories for download destination
#pairs = [ ( lfn, local_path ) ]
pairs = [ ( lfn, os.getcwd( ) ) ]

if len( args ) > 1:
  # local_path provided must be last argument
  local_path = args[ -1 ]
  lfns = args[ :-1 ]
  pairs = [ ]

  # STRANGE: dirac only accepts directories for download destination
  if not os.path.isdir( local_path ):
Esempio n. 3
0
Script.enableCS( )

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

session = DSession( )
catalog = DCatalog( )

if len( args ) < 2:
  print "Error: not enough arguments provided\n%s:" % Script.scriptName
  Script.showHelp( )
  DIRAC.exit( -1 )

mode = args[ 0 ]

lfns = [ ]
for path in args[ 1: ]:
  lfns.append( pathFromArgument( session, path ))

optstr = ""
if params.recursive:
  optstr = "-R "

from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI

fccli = FileCatalogClientCLI( catalog.catalog )

for lfn in lfns:
  fccli.do_chmod( optstr + mode + " " + lfn )
Esempio n. 4
0
  Script.parseCommandLine( ignoreErrors = True )
  args = Script.getPositionalArgs()

  session = DSession( )
  catalog = DCatalog( )

  if len( args ) < 1:
    print "Error: No argument provided\n%s:" % Script.scriptName
    Script.showHelp( )
    DIRAC.exit( 0 )

  # local file
  local_path = args[ 0 ]

  # default lfn: same file name as local_path
  lfn = pathFromArgument( session, os.path.basename( local_path ))

  pairs = [ ( local_path, lfn ) ]

  if len( args ) > 1:
    # lfn provided must be last argument
    lfn = pathFromArgument( session, args[ -1 ] )
    local_paths = args[ :-1 ]
    pairs = [ ]

    if catalog.isDir( lfn ):
      # we can accept one ore more local files
      for lp in local_paths:
        pairs.append( (lp, os.path.join( lfn, os.path.basename( lp )) ))
    else:
      if len( local_paths ) > 1: