Changeset 8e6fe4d for fedd/federation/emulab_access.py
- Timestamp:
- Mar 5, 2010 4:58:48 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- c5b28bf
- Parents:
- 444790d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
r444790d r8e6fe4d 11 11 12 12 from threading import * 13 from M2Crypto.SSL import SSLError 13 14 14 15 from util import * … … 1285 1286 if not fn: 1286 1287 fn = po.path.rpartition('/')[2] 1287 try:1288 conn = httplib.HTTPSConnection(po.hostname, port=po.port,1289 cert_file=cf, key_file=cf)1290 conn.putrequest('GET', po.path)1291 conn.endheaders()1292 response = conn.getresponse()1293 1294 lf = open("%s/%s" % (destdir, fn), "w")1295 buf = response.read(4096)1296 while buf: 1297 lf .write(buf)1288 ok = False 1289 retries = 0 1290 while not ok and retries < 5: 1291 try: 1292 conn = httplib.HTTPSConnection(po.hostname, port=po.port, 1293 cert_file=cf, key_file=cf) 1294 conn.putrequest('GET', po.path) 1295 conn.endheaders() 1296 response = conn.getresponse() 1297 1298 lf = open("%s/%s" % (destdir, fn), "w") 1298 1299 buf = response.read(4096) 1299 lf.close() 1300 except IOError, e: 1301 print e 1300 while buf: 1301 lf.write(buf) 1302 buf = response.read(4096) 1303 lf.close() 1304 ok = True 1305 except IOError, e: 1306 print e 1307 raise service_error(service_error.internal, 1308 "Error writing tempfile: %s" %e) 1309 except httplib.HTTPException, e: 1310 print e 1311 raise service_error(service_error.internal, 1312 "Error retrieving data: %s" % e) 1313 except SSLError, e: 1314 print "SSL error %s" %e 1315 retries += 1 1316 1317 if retries > 5: 1302 1318 raise service_error(service_error.internal, 1303 "Error writing tempfile: %s" %e) 1304 except httplib.HTTPException, e: 1305 print e 1306 raise service_error(service_error.internal, 1307 "Error retrieving data: %s" % e) 1319 "Repeated SSL failures") 1308 1320 1309 1321 configs = set(('hosts', 'ssh_pubkey', 'ssh_secretkey'))
Note: See TracChangeset
for help on using the changeset viewer.