ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/GliteConfig.py
Revision: 1.5
Committed: Thu Jun 28 23:08:07 2007 UTC (17 years, 10 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_1_5_4_SLC3_pre1, CRAB_1_5_4_pre1, CRAB_2_0_0_pre7, CRAB_2_0_0_pre6, CRAB_1_5_3, CRAB_1_5_3_pre5, CRAB_1_5_3_pre4, CRAB_2_0_0_pre5, CRAB_1_5_3_pre3, configure, CRAB_2_0_0_pre4
Branch point for: CRAB_1_5_4_SLC3_start
Changes since 1.4: +2 -2 lines
Log Message:
rollback (WMconfig file not in share)

File Contents

# User Rev Content
1 fanzago 1.1 from crab_logger import Logger
2     from crab_exceptions import *
3     from crab_util import *
4     import common
5    
6     import urllib
7 slacapra 1.2 import os, time
8 fanzago 1.1
9     class GliteConfig:
10     def __init__(self, RB):
11     common.logger.debug(5,'Calling GliteConfig')
12     self.url = 'http://cmsdoc.cern.ch/cms/ccs/wm/www/Crab/useful_script/'
13     self.configFileName = 'glite.conf.CMS_'+str(RB)
14     self.theConfig = self.getConfig_()
15     pass
16    
17     def config(self):
18     return self.theConfig
19    
20     def getConfig_(self):
21     if not os.path.exists(self.configFileName):
22     url = self.url+self.configFileName
23     common.logger.message('Downloading config files for RB: '+url)
24     try:
25     f = urllib.urlopen(url)
26 spiga 1.5 ff = open(self.configFileName, 'w')
27 fanzago 1.1 ff.write(f.read())
28     ff.close()
29     except IOError:
30     # print 'Cannot access URL: '+url
31     raise CrabException('Cannot download config file '+self.configFileName+' from '+self.url)
32 spiga 1.5 return os.getcwd()+'/'+self.configFileName