Changeset 8e6fe4d for fedd/federation/protogeni_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/protogeni_access.py
r444790d r8e6fe4d 11 11 12 12 from threading import * 13 from M2Crypto.SSL import SSLError 13 14 14 15 from util import * … … 881 882 if not fn: 882 883 fn = po.path.rpartition('/')[2] 883 try:884 conn = httplib.HTTPSConnection(po.hostname, port=po.port,885 cert_file=cf, key_file=cf)886 conn.putrequest('GET', po.path)887 conn.endheaders()888 response = conn.getresponse()889 890 lf = open("%s/%s" % (destdir, fn), "w")891 buf = response.read(4096)892 while buf: 893 lf .write(buf)884 retries = 0 885 ok = False 886 while not ok and retries < 5: 887 try: 888 conn = httplib.HTTPSConnection(po.hostname, port=po.port, 889 cert_file=cf, key_file=cf) 890 conn.putrequest('GET', po.path) 891 conn.endheaders() 892 response = conn.getresponse() 893 894 lf = open("%s/%s" % (destdir, fn), "w") 894 895 buf = response.read(4096) 895 lf.close() 896 except IOError, e: 897 print e 896 while buf: 897 lf.write(buf) 898 buf = response.read(4096) 899 lf.close() 900 ok = True 901 except IOError, e: 902 print e 903 raise service_error(service_error.internal, 904 "Error writing tempfile: %s" %e) 905 except httplib.HTTPException, e: 906 print e 907 raise service_error(service_error.internal, 908 "Error retrieving data: %s" % e) 909 except SSLError, e: 910 print "SSL error %s" %e 911 retries += 1 912 913 if retries > 5: 898 914 raise service_error(service_error.internal, 899 "Error writing tempfile: %s" %e) 900 except httplib.HTTPException, e: 901 print e 902 raise service_error(service_error.internal, 903 "Error retrieving data: %s" % e) 915 "Repeated SSL failures") 916 904 917 905 918 configs = set(('hosts', 'ssh_pubkey', 'ssh_secretkey'))
Note: See TracChangeset
for help on using the changeset viewer.