10 |
|
def __init__(self, serverName): |
11 |
|
common.logger.debug(5,'Calling ServerConfig') |
12 |
|
self.url = 'http://cmsdoc.cern.ch/cms/ccs/wm/www/Crab/useful_script/Server_conf/' |
13 |
< |
self.configFileName = 'server_%s.conf'%string.lower(serverName) |
13 |
> |
if 'server_' in string.lower(serverName): |
14 |
> |
self.configFileName = '%s.conf'%string.lower(serverName) |
15 |
> |
else: |
16 |
> |
self.configFileName = 'server_%s.conf'%string.lower(serverName) |
17 |
> |
|
18 |
|
localCfg = self.getConfig_() |
19 |
|
|
20 |
|
# parse the localCfg file |
33 |
|
def downloadFile(self, url, destination): |
34 |
|
try: |
35 |
|
f = urllib.urlopen(url) |
36 |
+ |
data = f.read() |
37 |
+ |
if '<!' in data[:2]: |
38 |
+ |
raise IOError |
39 |
+ |
|
40 |
|
ff = open(destination, 'w') |
41 |
< |
ff.write(f.read()) |
41 |
> |
ff.write(data) |
42 |
|
ff.close() |
43 |
|
except IOError: |
44 |
|
raise CrabException('Cannot download config file '+destination+' from '+self.url) |