Пример #1
0
                        )

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

session = DSession( )

if len( args ) > 1:
  print "Error: too many arguments provided\n%s:" % Script.scriptName
  Script.showHelp( )
  DIRAC.exit( -1 )

if len( args ):
  arg = args[ 0 ]
  if not os.path.isabs( arg ):
    arg = os.path.normpath( os.path.join( session.getCwd( ), arg ))
else:
  arg = session.homeDir( )

Script.enableCS( )

catalog = DCatalog( )

if catalog.isDir( arg ):
  if( session.getCwd( ) != arg ):
    session.setCwd( arg )
    session.write( )
else:
  critical( "Error: \"%s\" not a valid directory" % arg )

Пример #2
0
#!/usr/bin/env python

"""
print DCommands working directory
"""

import os

from COMDIRAC.Interfaces import critical

from COMDIRAC.Interfaces import DSession

if __name__ == "__main__":
  import sys
  from DIRAC.Core.Base import Script

  Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
                                       'Usage:',
                                       '  %s [options]' % Script.scriptName,
                                       ] )
                          )

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

  session = DSession( )

  ret = session.getCwd( )

  print ret
Пример #3
0
from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac

import DIRAC.Core.Security.ProxyInfo as ProxyInfo

import DIRAC.FrameworkSystem.Client.ProxyGeneration as ProxyGeneration

from DIRAC.Core.Security import Locations, VOMS
from DIRAC.Core.Utilities.PrettyPrint import printTable

##################################
##################################
## Current pwd
session = DSession()
PWD = session.getCwd( )

## printer
pp = pprint.PrettyPrinter(indent=4)

## PROXY MANAGEMENT STUFF - before anything else
def _getProxyLocation():
  return Locations.getProxyLocation()

def _getProxyInfo( proxyPath = False ):
    if not proxyPath:
        proxyPath = _getProxyLocation()
    proxy_info = ProxyInfo.getProxyInfo( proxyPath, False )
    return proxy_info

proxy_info = _getProxyInfo()