Changeset 8e6fe4d
- Timestamp:
- Mar 5, 2010 4:58:48 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- c5b28bf
- Parents:
- 444790d
- Location:
- fedd/federation
- Files:
-
- 4 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')) -
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')) -
fedd/federation/proxy_protogeni_segment.py
r444790d r8e6fe4d 80 80 # interfaces in 'interfaces'. I love having XML parser code lying around. 81 81 def manifest_to_dict(self, manifest): 82 # XXX 83 # if self.debug: return { } 82 if self.debug: return { } 84 83 85 84 # The class allows us to keep a little state - the dict under … … 202 201 print >>script, \ 203 202 "%s -C %s -xzf %s" % (tar, s.install, s_base) 204 for f in ('hosts', pubkey, secretkey): 203 for f in ('hosts', pubkey, secretkey, 'client.conf', 204 'userconf', 'seer.conf'): 205 205 print >>script, "%s %s@%s:%s/%s %s/etc" % \ 206 206 (scp, user, host, stagingdir, f, fed_dir) … … 215 215 (scp, user, host, stagingdir, vname, fed_dir) 216 216 217 217 218 # Start commands 218 219 if e.get_attribute('portal') and gate_cmd: … … 220 221 print >>script, gate_cmd 221 222 elif node_cmd: 223 # XXX: debug 224 print >>script, "sudo perl -I%s/lib %s/bin/import_key.pl /users/%s/.ssh/authorized_keys /root/.ssh/authorized_keys" % (fed_dir, fed_dir, user) 225 # XXX: debug 222 226 if e.get_attribute('startup'): 223 227 print >>script, "%s \\$USER '%s'" % \ -
fedd/federation/remote_service.py
r444790d r8e6fe4d 298 298 self.tracefile = tracefile 299 299 self.__call__ = self.call_service 300 self.max_retries = 5 300 301 301 302 def serialize_soap(self, req): … … 343 344 port = ServerProxy(url, transport=transport) 344 345 # Make the call, and convert faults back to service_errors 345 try: 346 remote_method = getattr(port, self.service_name, None) 347 if self.request_body_name: 348 resp = remote_method(self.apply_to_tags(\ 349 { self.request_body_name: r}, self.encap_fedids)) 350 else: 351 resp = remote_method(self.apply_to_tags(r, self.encap_fedids)) 352 except socket_error, e: 353 raise service_error(service_error.connect, 354 "Cannot connect to %s: %s" % (url, e[1])) 355 except SSLError, e: 356 raise service_error(service_error.connect, 357 "SSL error contacting %s: %s" % (url, e.message)) 358 except Fault, f: 359 raise service_error(f.faultCode, f.faultString) 360 except Error, e: 361 raise service_error(service_error.protocol, 362 "Remote XMLRPC Fault: %s" % e) 346 if self.request_body_name: 347 r = self.apply_to_tags(\ 348 { self.request_body_name: r}, self.encap_fedids) 349 else: 350 r = self.apply_to_tags(r, self.encap_fedids) 351 352 ok = False 353 retries = 0 354 355 while not ok and retries < self.max_retries: 356 try: 357 remote_method = getattr(port, self.service_name, None) 358 resp = remote_method(r) 359 except socket_error, e: 360 raise service_error(service_error.connect, 361 "Cannot connect to %s: %s" % (url, e[1])) 362 except SSLError, e: 363 print "SSL error contacting %s: %s" % (url, e.message) 364 retries += 1 365 except Fault, f: 366 raise service_error(f.faultCode, f.faultString) 367 except Error, e: 368 raise service_error(service_error.protocol, 369 "Remote XMLRPC Fault: %s" % e) 370 371 if retries > self.max_retries : 372 raise service_error(req.connect, "Too many SSL failures") 363 373 364 374 return self.apply_to_tags(resp, self.decap_fedids) … … 413 423 self.request_body_name) 414 424 set_element(self.pack_soap(msg, self.request_body_name, req)) 415 try: 416 resp = remote_method(msg) 417 except socket_error, e: 418 raise service_error(service_error.connect, 419 "Cannot connect to %s: %s" % (url, e[1])) 420 except SSLError, e: 421 raise service_error(service_error.connect, 422 "SSL error contacting %s: %s" % (url, e.message)) 423 except ParseException, e: 424 raise service_error(service_error.protocol, 425 "Bad format message (XMLRPC??): %s" % e) 426 except FaultException, e: 427 ee = self.unpack_soap(e.fault.detail[0]).get('FeddFaultBody', { }) 428 if ee: 429 raise service_error(ee['code'], ee['desc']) 430 else: 431 raise service_error(service_error.internal, 432 "Unexpected fault body") 425 ok = False 426 retries = 0 427 while not ok and retries < self.max_retries: 428 try: 429 resp = remote_method(msg) 430 ok = True 431 except socket_error, e: 432 raise service_error(service_error.connect, 433 "Cannot connect to %s: %s" % (url, e[1])) 434 except SSLError, e: 435 print "SSL error contacting %s: %s" % (url, e.message) 436 retries += 1 437 except ParseException, e: 438 raise service_error(service_error.protocol, 439 "Bad format message (XMLRPC??): %s" % e) 440 except FaultException, e: 441 ee = self.unpack_soap(e.fault.detail[0]).get('FeddFaultBody', 442 { }) 443 if ee: 444 raise service_error(ee['code'], ee['desc']) 445 else: 446 raise service_error(service_error.internal, 447 "Unexpected fault body") 448 449 if retries > self.max_retries : 450 raise service_error(req.connect, "Too many SSL failures") 451 433 452 # Unpack and convert fedids to objects 434 453 r = self.apply_to_tags(self.unpack_soap(resp), self.fedid_to_object) 454 435 455 # Make sure all strings are unicode 436 456 r = self.make_unicode(r)
Note: See TracChangeset
for help on using the changeset viewer.