Esempio n. 1
0
    def getExternalPackageVersions(self):
        """
    Simple function that attempts to obtain the external versions for
    the local DIRAC installation (frequently needed for debugging purposes).
    """
        gLogger.info(
            'DIRAC version v%dr%d build %d' %
            (DIRAC.majorVersion, DIRAC.minorVersion, DIRAC.patchLevel))
        try:
            import lcg_util
            infoStr = 'Using lcg_util from: \n%s' % lcg_util.__file__
            gLogger.info(infoStr)
            infoStr = "The version of lcg_utils is %s" % lcg_util.lcg_util_version(
            )
            gLogger.info(infoStr)
        except Exception as x:
            errStr = "SRM2Storage.__init__: Failed to import lcg_util: %s" % (
                x)
            gLogger.exception(errStr)

        try:
            import gfalthr as gfal
            infoStr = "Using gfalthr from: \n%s" % gfal.__file__
            gLogger.info(infoStr)
            infoStr = "The version of gfalthr is %s" % gfal.gfal_version()
            gLogger.info(infoStr)
        except Exception as x:
            errStr = "SRM2Storage.__init__: Failed to import gfalthr: %s." % (
                x)
            gLogger.warn(errStr)
            try:
                import gfal
                infoStr = "Using gfal from: %s" % gfal.__file__
                gLogger.info(infoStr)
                infoStr = "The version of gfal is %s" % gfal.gfal_version()
                gLogger.info(infoStr)
            except Exception as x:
                errStr = "SRM2Storage.__init__: Failed to import gfal: %s" % (
                    x)
                gLogger.exception(errStr)

        defaultProtocols = gConfig.getValue(
            '/Resources/StorageElements/DefaultProtocols', [])
        gLogger.info('Default list of protocols are: %s' %
                     (', '.join(defaultProtocols)))
        return S_OK()
Esempio n. 2
0
    def getExternalPackageVersions(self):
        """
    Simple function that attempts to obtain the external versions for
    the local DIRAC installation (frequently needed for debugging purposes).
    """
        gLogger.info("DIRAC version v%dr%d build %d" % (DIRAC.majorVersion, DIRAC.minorVersion, DIRAC.patchLevel))
        try:
            import lcg_util

            infoStr = "Using lcg_util from: \n%s" % lcg_util.__file__
            gLogger.info(infoStr)
            infoStr = "The version of lcg_utils is %s" % lcg_util.lcg_util_version()
            gLogger.info(infoStr)
        except Exception as x:
            errStr = "SRM2Storage.__init__: Failed to import lcg_util: %s" % (x)
            gLogger.exception(errStr)

        try:
            import gfalthr as gfal

            infoStr = "Using gfalthr from: \n%s" % gfal.__file__
            gLogger.info(infoStr)
            infoStr = "The version of gfalthr is %s" % gfal.gfal_version()
            gLogger.info(infoStr)
        except Exception as x:
            errStr = "SRM2Storage.__init__: Failed to import gfalthr: %s." % (x)
            gLogger.warn(errStr)
            try:
                import gfal

                infoStr = "Using gfal from: %s" % gfal.__file__
                gLogger.info(infoStr)
                infoStr = "The version of gfal is %s" % gfal.gfal_version()
                gLogger.info(infoStr)
            except Exception as x:
                errStr = "SRM2Storage.__init__: Failed to import gfal: %s" % (x)
                gLogger.exception(errStr)

        defaultProtocols = gConfig.getValue("/Resources/StorageElements/DefaultProtocols", [])
        gLogger.info("Default list of protocols are: %s" % (", ".join(defaultProtocols)))
        return S_OK()
Esempio n. 3
0
def getInfo():
  """Retrieve information about setup, etc."""
  records = []

  records.append(('Setup', gConfig.getValue('/DIRAC/Setup', 'Unknown')))
  records.append(('ConfigurationServer', gConfig.getValue('/DIRAC/Configuration/Servers', [])))
  records.append(('Installation path', DIRAC.rootPath))

  if os.path.exists(os.path.join(DIRAC.rootPath, DIRAC.getPlatform(), 'bin', 'mysql')):
    records.append(('Installation type', 'server'))
  else:
    records.append(('Installation type', 'client'))

  records.append(('Platform', DIRAC.getPlatform()))

  ret = getProxyInfo(disableVOMS=False)
  if ret['OK']:
    print(pprint.pformat(ret))
    if 'group' in ret['Value']:
      vo = getVOForGroup(ret['Value']['group'])
    else:
      vo = getVOForGroup('')
    if not vo:
      vo = "None"
    records.append(('VirtualOrganization', vo))
    if 'identity' in ret['Value']:
      records.append(('User DN', ret['Value']['identity']))
    if 'secondsLeft' in ret['Value']:
      records.append(('Proxy validity, secs', {'Value': str(ret['Value']['secondsLeft']), 'Just': 'L'}))

  if gConfig.getValue('/DIRAC/Security/UseServerCertificate', True):
    records.append(('Use Server Certificate', 'Yes'))
  else:
    records.append(('Use Server Certificate', 'No'))
  if gConfig.getValue('/DIRAC/Security/SkipCAChecks', False):
    records.append(('Skip CA Checks', 'Yes'))
  else:
    records.append(('Skip CA Checks', 'No'))

  try:
    import gfalthr  # pylint: disable=import-error
    records.append(('gfal version', gfalthr.gfal_version()))
  except BaseException:
    pass

  fields = ['Option', 'Value']

  return fields, records
Esempio n. 4
0
    records.append(('User DN', ret['Value']['identity']))
  if 'secondsLeft' in ret['Value']:
    records.append(('Proxy validity, secs', {'Value': str(ret['Value']['secondsLeft']), 'Just': 'L'}))

if gConfig.getValue('/DIRAC/Security/UseServerCertificate', True):
  records.append(('Use Server Certificate', 'Yes'))
else:
  records.append(('Use Server Certificate', 'No'))
if gConfig.getValue('/DIRAC/Security/SkipCAChecks', False):
  records.append(('Skip CA Checks', 'Yes'))
else:
  records.append(('Skip CA Checks', 'No'))

try:
  import gfalthr  # pylint: disable=import-error
  records.append(('gfal version', gfalthr.gfal_version()))
except BaseException:
  pass

try:
  import lcg_util  # pylint: disable=import-error
  records.append(('lcg_util version', lcg_util.lcg_util_version()))
except BaseException:
  pass

records.append(('DIRAC version', DIRAC.version))

fields = ['Option', 'Value']

print()
printTable(fields, records, numbering=False)
Esempio n. 5
0
            import lcg_util
            infoStr = 'Using lcg_util from: \n%s' % lcg_util.__file__
            gLogger.info(infoStr)
            infoStr = "The version of lcg_utils is %s" % lcg_util.lcg_util_version(
            )
            gLogger.info(infoStr)
        except Exception, x:
            errStr = "SRM2Storage.__init__: Failed to import lcg_util: %s" % (
                x)
            gLogger.exception(errStr)

        try:
            import gfalthr as gfal
            infoStr = "Using gfalthr from: \n%s" % gfal.__file__
            gLogger.info(infoStr)
            infoStr = "The version of gfalthr is %s" % gfal.gfal_version()
            gLogger.info(infoStr)
        except Exception, x:
            errStr = "SRM2Storage.__init__: Failed to import gfalthr: %s." % (
                x)
            gLogger.warn(errStr)
            try:
                import gfal
                infoStr = "Using gfal from: %s" % gfal.__file__
                gLogger.info(infoStr)
                infoStr = "The version of gfal is %s" % gfal.gfal_version()
                gLogger.info(infoStr)
            except Exception, x:
                errStr = "SRM2Storage.__init__: Failed to import gfal: %s" % (
                    x)
                gLogger.exception(errStr)
Esempio n. 6
0
    gLogger.info( 'DIRAC version v%dr%d build %d' % ( DIRAC.majorVersion, DIRAC.minorVersion, DIRAC.patchLevel ) )
    try:
      import lcg_util
      infoStr = 'Using lcg_util from: \n%s' % lcg_util.__file__
      gLogger.info( infoStr )
      infoStr = "The version of lcg_utils is %s" % lcg_util.lcg_util_version()
      gLogger.info( infoStr )
    except Exception, x:
      errStr = "SRM2Storage.__init__: Failed to import lcg_util: %s" % ( x )
      gLogger.exception( errStr )

    try:
      import gfalthr as gfal
      infoStr = "Using gfalthr from: \n%s" % gfal.__file__
      gLogger.info( infoStr )
      infoStr = "The version of gfalthr is %s" % gfal.gfal_version()
      gLogger.info( infoStr )
    except Exception, x:
      errStr = "SRM2Storage.__init__: Failed to import gfalthr: %s." % ( x )
      gLogger.warn( errStr )
      try:
        import gfal
        infoStr = "Using gfal from: %s" % gfal.__file__
        gLogger.info( infoStr )
        infoStr = "The version of gfal is %s" % gfal.gfal_version()
        gLogger.info( infoStr )
      except Exception, x:
        errStr = "SRM2Storage.__init__: Failed to import gfal: %s" % ( x )
        gLogger.exception( errStr )

Esempio n. 7
0
Script.parseCommandLine(ignoreErrors=True)
args = Script.getPositionalArgs()

infoDict = {}

infoDict['Setup'] = gConfig.getValue('/DIRAC/Setup', 'Unknown')
infoDict['ConfigurationServer'] = gConfig.getValue(
    '/DIRAC/Configuration/Servers', [])
ret = getProxyInfo(disableVOMS=True)
if ret['OK'] and 'group' in ret['Value']:
    infoDict['VirtualOrganization'] = getVOForGroup(ret['Value']['group'])
else:
    infoDict['VirtualOrganization'] = getVOForGroup('')

try:
    import gfalthr
    infoDict['gfal version'] = gfalthr.gfal_version()
except:
    pass

try:
    import lcg_util
    infoDict['lcg_util version'] = lcg_util.lcg_util_version()
except:
    pass

print 'DIRAC version'.rjust(20), ':', DIRAC.version

for k, v in infoDict.items():
    print k.rjust(20), ':', str(v)
Esempio n. 8
0
                                     '  %s [option|cfgfile] ... Site' % Script.scriptName, ] ) )
Script.parseCommandLine( ignoreErrors = True )
args = Script.getPositionalArgs()

infoDict = {}

infoDict['Setup'] = gConfig.getValue( '/DIRAC/Setup', 'Unknown' )
infoDict['ConfigurationServer'] = gConfig.getValue( '/DIRAC/Configuration/Servers', [] )
ret = getProxyInfo( disableVOMS = True )
if ret['OK'] and 'group' in ret['Value']:
  infoDict['VirtualOrganization'] = getVOForGroup( ret['Value']['group'] )
else:
  infoDict['VirtualOrganization'] = getVOForGroup( '' )
  
try:
  import gfalthr
  infoDict['gfal version'] = gfalthr.gfal_version()
except:
  pass

try:
  import lcg_util
  infoDict['lcg_util version'] = lcg_util.lcg_util_version()
except:
  pass    

print 'DIRAC version'.rjust( 20 ), ':', DIRAC.version

for k, v in infoDict.items():
  print k.rjust( 20 ), ':', str( v )
Esempio n. 9
0
  if 'secondsLeft' in ret['Value']:
    records.append( ('Proxy validity, secs', str( ret['Value']['secondsLeft'] ) ) )
  
if gConfig.getValue( '/DIRAC/Security/UseServerCertificate', True ):
  records.append( ('Use Server Certificate', 'Yes' ) )
else:
  records.append( ('Use Server Certificate', 'No' ) )
if gConfig.getValue( '/DIRAC/Security/SkipCAChecks', False ):
  records.append( ('Skip CA Checks', 'Yes' ) )
else:
  records.append( ('Skip CA Checks', 'No' ) )
    
  
try:
  import gfalthr
  records.append( ('gfal version', gfalthr.gfal_version() ) )
except:
  pass

try:
  import lcg_util
  records.append( ('lcg_util version', lcg_util.lcg_util_version() ) )
except:
  pass    

records.append( ('DIRAC version', DIRAC.version ) )

fields = ['Option','Value']

print
printTable( fields, records, numbering=False )