Пример #1
0
 def execute(self):
   """ Standard method for pilot commands
   """
   if self.pp.releaseVersion:
     self.log.info( "Pilot version requested as pilot script option. Nothing to do." )
   else:
     try:
       import json
     except ImportError:
       self.log.error( 'No json module available, exiting ...' )
       sys.exit( 2 )
     self.log.info( "Pilot version not requested as pilot script option, going to find it" )
     result = retrieveUrlTimeout( self.pp.pilotCFGFileLocation + '/' + self.pp.pilotCFGFile,
                                  self.pp.pilotCFGFile,
                                  self.log,
                                  timeout = 120 )
     if not result:
       self.log.error( "Failed to get pilot version, exiting ...")
       sys.exit( 1 )
     fp = open( self.pp.pilotCFGFile + '-local', 'r' )
     pilotCFGFileContent = json.load( fp )
     fp.close()
     pilotVersions = [str( pv ) for pv in pilotCFGFileContent[self.pp.setup]['Version']]
     self.log.debug( "Pilot versions found: %s" % ', '.join( pilotVersions ) )
     self.log.info( "Setting pilot version to %s" % pilotVersions[0] )
     self.pp.releaseVersion = pilotVersions[0]
Пример #2
0
 def execute(self):
     """ Standard method for pilot commands
 """
     if self.pp.releaseVersion:
         self.log.info(
             "Pilot version requested as pilot script option. Nothing to do."
         )
     else:
         try:
             import json
         except ImportError:
             self.log.error('No json module available, exiting ...')
             sys.exit(2)
         self.log.info(
             "Pilot version not requested as pilot script option, going to find it"
         )
         result = retrieveUrlTimeout(self.pp.pilotCFGFileLocation + '/' +
                                     self.pp.pilotCFGFile,
                                     self.pp.pilotCFGFile,
                                     self.log,
                                     timeout=120)
         if not result:
             self.log.error("Failed to get pilot version, exiting ...")
             sys.exit(1)
         fp = open(self.pp.pilotCFGFile + '-local', 'r')
         pilotCFGFileContent = json.load(fp)
         fp.close()
         pilotVersions = [
             str(pv) for pv in pilotCFGFileContent[self.pp.setup]['Version']
         ]
         self.log.debug("Pilot versions found: %s" %
                        ', '.join(pilotVersions))
         self.log.info("Setting pilot version to %s" % pilotVersions[0])
         self.pp.releaseVersion = pilotVersions[0]