Index: fedd/federation/emulab_access.py
===================================================================
--- fedd/federation/emulab_access.py	(revision c119839a168ca2908841e5d9666def8a597e80d9)
+++ fedd/federation/emulab_access.py	(revision 8e6fe4dbe8004d48825d896354ee09ffb11af283)
@@ -11,4 +11,5 @@
 
 from threading import *
+from M2Crypto.SSL import SSLError
 
 from util import *
@@ -1285,25 +1286,36 @@
 	    if not fn:
 		fn = po.path.rpartition('/')[2]
-	    try:
-		conn = httplib.HTTPSConnection(po.hostname, port=po.port, 
-			cert_file=cf, key_file=cf)
-		conn.putrequest('GET', po.path)
-		conn.endheaders()
-		response = conn.getresponse()
-
-		lf = open("%s/%s" % (destdir, fn), "w")
-		buf = response.read(4096)
-		while buf:
-		    lf.write(buf)
+	    ok = False
+	    retries = 0
+	    while not ok and retries < 5:
+		try:
+		    conn = httplib.HTTPSConnection(po.hostname, port=po.port, 
+			    cert_file=cf, key_file=cf)
+		    conn.putrequest('GET', po.path)
+		    conn.endheaders()
+		    response = conn.getresponse()
+
+		    lf = open("%s/%s" % (destdir, fn), "w")
 		    buf = response.read(4096)
-		lf.close()
-	    except IOError, e:
-		print e
+		    while buf:
+			lf.write(buf)
+			buf = response.read(4096)
+		    lf.close()
+		    ok = True
+		except IOError, e:
+		    print e
+		    raise service_error(service_error.internal,
+			    "Error writing tempfile: %s" %e)
+		except httplib.HTTPException, e:
+		    print e
+		    raise service_error(service_error.internal, 
+			    "Error retrieving data: %s" % e)
+		except SSLError, e:
+		    print "SSL error %s" %e
+		    retries += 1
+
+	    if retries > 5:
 		raise service_error(service_error.internal,
-			"Error writing tempfile: %s" %e)
-	    except httplib.HTTPException, e:
-		print e
-		raise service_error(service_error.internal, 
-			"Error retrieving data: %s" % e)
+			"Repeated SSL failures")
 
 	configs = set(('hosts', 'ssh_pubkey', 'ssh_secretkey'))
Index: fedd/federation/protogeni_access.py
===================================================================
--- fedd/federation/protogeni_access.py	(revision c119839a168ca2908841e5d9666def8a597e80d9)
+++ fedd/federation/protogeni_access.py	(revision 8e6fe4dbe8004d48825d896354ee09ffb11af283)
@@ -11,4 +11,5 @@
 
 from threading import *
+from M2Crypto.SSL import SSLError
 
 from util import *
@@ -881,25 +882,37 @@
 	    if not fn:
 		fn = po.path.rpartition('/')[2]
-	    try:
-		conn = httplib.HTTPSConnection(po.hostname, port=po.port, 
-			cert_file=cf, key_file=cf)
-		conn.putrequest('GET', po.path)
-		conn.endheaders()
-		response = conn.getresponse()
-
-		lf = open("%s/%s" % (destdir, fn), "w")
-		buf = response.read(4096)
-		while buf:
-		    lf.write(buf)
+	    retries = 0
+	    ok = False
+	    while not ok and retries < 5:
+		try:
+		    conn = httplib.HTTPSConnection(po.hostname, port=po.port, 
+			    cert_file=cf, key_file=cf)
+		    conn.putrequest('GET', po.path)
+		    conn.endheaders()
+		    response = conn.getresponse()
+
+		    lf = open("%s/%s" % (destdir, fn), "w")
 		    buf = response.read(4096)
-		lf.close()
-	    except IOError, e:
-		print e
+		    while buf:
+			lf.write(buf)
+			buf = response.read(4096)
+		    lf.close()
+		    ok = True
+		except IOError, e:
+		    print e
+		    raise service_error(service_error.internal,
+			    "Error writing tempfile: %s" %e)
+		except httplib.HTTPException, e:
+		    print e
+		    raise service_error(service_error.internal, 
+			    "Error retrieving data: %s" % e)
+		except SSLError, e:
+		    print "SSL error %s" %e
+		    retries += 1
+
+	    if retries > 5:
 		raise service_error(service_error.internal,
-			"Error writing tempfile: %s" %e)
-	    except httplib.HTTPException, e:
-		print e
-		raise service_error(service_error.internal, 
-			"Error retrieving data: %s" % e)
+			"Repeated SSL failures")
+
 
 	configs = set(('hosts', 'ssh_pubkey', 'ssh_secretkey'))
Index: fedd/federation/proxy_protogeni_segment.py
===================================================================
--- fedd/federation/proxy_protogeni_segment.py	(revision c119839a168ca2908841e5d9666def8a597e80d9)
+++ fedd/federation/proxy_protogeni_segment.py	(revision 8e6fe4dbe8004d48825d896354ee09ffb11af283)
@@ -80,6 +80,5 @@
     # interfaces in 'interfaces'.  I love having XML parser code lying around.
     def manifest_to_dict(self, manifest):
-	# XXX
-	# if self.debug: return { }
+	if self.debug: return { }
 
 	# The class allows us to keep a little state - the dict under
@@ -202,5 +201,6 @@
 		    print >>script, \
 			    "%s -C %s -xzf %s" % (tar, s.install, s_base)
-		for f in ('hosts', pubkey, secretkey):
+		for f in ('hosts', pubkey, secretkey, 'client.conf', 
+			'userconf', 'seer.conf'):
 		    print >>script, "%s %s@%s:%s/%s %s/etc" % \
 			    (scp, user, host, stagingdir, f, fed_dir)
@@ -215,4 +215,5 @@
 			    (scp, user, host, stagingdir, vname, fed_dir)
 
+
 		# Start commands
 		if e.get_attribute('portal') and gate_cmd:
@@ -220,4 +221,7 @@
 		    print >>script, gate_cmd
 		elif node_cmd:
+		    # XXX: debug
+		    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)
+		    # XXX: debug
 		    if e.get_attribute('startup'):
 			print >>script, "%s \\$USER '%s'" % \
Index: fedd/federation/remote_service.py
===================================================================
--- fedd/federation/remote_service.py	(revision c119839a168ca2908841e5d9666def8a597e80d9)
+++ fedd/federation/remote_service.py	(revision 8e6fe4dbe8004d48825d896354ee09ffb11af283)
@@ -298,4 +298,5 @@
 	self.tracefile = tracefile
 	self.__call__ = self.call_service
+	self.max_retries = 5
 
     def serialize_soap(self, req):
@@ -343,22 +344,31 @@
 	port = ServerProxy(url, transport=transport)
 	# Make the call, and convert faults back to service_errors
-	try:
-	    remote_method = getattr(port, self.service_name, None)
-	    if self.request_body_name:
-		resp = remote_method(self.apply_to_tags(\
-			{ self.request_body_name: r}, self.encap_fedids))
-	    else:
-		resp = remote_method(self.apply_to_tags(r, self.encap_fedids))
-	except socket_error, e:
-	    raise service_error(service_error.connect, 
-		    "Cannot connect to %s: %s" % (url, e[1]))
-	except SSLError, e:
-	    raise service_error(service_error.connect,
-		    "SSL error contacting %s: %s" % (url, e.message))
-	except Fault, f:
-	    raise service_error(f.faultCode, f.faultString)
-	except Error, e:
-	    raise service_error(service_error.protocol, 
-		    "Remote XMLRPC Fault: %s" % e)
+	if self.request_body_name:
+	    r  = self.apply_to_tags(\
+		    { self.request_body_name: r}, self.encap_fedids)
+	else:
+	    r = self.apply_to_tags(r, self.encap_fedids)
+
+	ok = False
+	retries = 0
+
+	while not ok and retries < self.max_retries:
+	    try:
+		remote_method = getattr(port, self.service_name, None)
+		resp = remote_method(r)
+	    except socket_error, e:
+		raise service_error(service_error.connect, 
+			"Cannot connect to %s: %s" % (url, e[1]))
+	    except SSLError, e:
+		print "SSL error contacting %s: %s" % (url, e.message)
+		retries += 1
+	    except Fault, f:
+		raise service_error(f.faultCode, f.faultString)
+	    except Error, e:
+		raise service_error(service_error.protocol, 
+			"Remote XMLRPC Fault: %s" % e)
+
+	if retries > self.max_retries :
+	    raise service_error(req.connect, "Too many SSL failures")
 
 	return self.apply_to_tags(resp, self.decap_fedids) 
@@ -413,24 +423,34 @@
 			    self.request_body_name)
 	set_element(self.pack_soap(msg, self.request_body_name, req))
-	try:
-	    resp = remote_method(msg)
-	except socket_error, e:
-	    raise service_error(service_error.connect, 
-		    "Cannot connect to %s: %s" % (url, e[1]))
-	except SSLError, e:
-	    raise service_error(service_error.connect,
-		    "SSL error contacting %s: %s" % (url, e.message))
-	except ParseException, e:
-	    raise service_error(service_error.protocol,
-		    "Bad format message (XMLRPC??): %s" % e)
-	except FaultException, e:
-	    ee = self.unpack_soap(e.fault.detail[0]).get('FeddFaultBody', { })
-	    if ee:
-		raise service_error(ee['code'], ee['desc'])
-	    else:
-		raise service_error(service_error.internal,
-			"Unexpected fault body")
+	ok = False
+	retries = 0
+	while not ok and retries < self.max_retries:
+	    try:
+		resp = remote_method(msg)
+		ok = True
+	    except socket_error, e:
+		raise service_error(service_error.connect, 
+			"Cannot connect to %s: %s" % (url, e[1]))
+	    except SSLError, e:
+		print "SSL error contacting %s: %s" % (url, e.message)
+		retries += 1
+	    except ParseException, e:
+		raise service_error(service_error.protocol,
+			"Bad format message (XMLRPC??): %s" % e)
+	    except FaultException, e:
+		ee = self.unpack_soap(e.fault.detail[0]).get('FeddFaultBody',
+			{ })
+		if ee:
+		    raise service_error(ee['code'], ee['desc'])
+		else:
+		    raise service_error(service_error.internal,
+			    "Unexpected fault body")
+
+	if retries > self.max_retries :
+	    raise service_error(req.connect, "Too many SSL failures")
+
 	# Unpack and convert fedids to objects
 	r = self.apply_to_tags(self.unpack_soap(resp), self.fedid_to_object)
+
 	#  Make sure all strings are unicode
 	r = self.make_unicode(r)
