Commit f0210c80 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Wild little hack to look for a 511 error code from the protogeni

wrapper, which means the server is WAY too busy. Instead of just
bailing, retry every 5 seconds. User is free to hit ^C to halt the
loop, no harm done.
parent b4750aa2
......@@ -18,6 +18,7 @@ import xmlrpclib
import M2Crypto
from M2Crypto import X509
import socket
import time;
# Debugging output.
debug = 0
......@@ -246,23 +247,31 @@ def do_method(module, method, params, URI=None, quiet=False, version=None,
#
# Make the call.
#
try:
response = apply(meth, meth_args)
while True:
try:
response = apply(meth, meth_args)
break
except xmlrpclib.Fault, e:
if not quiet: print >> sys.stderr, e.faultString
if e.faultCode == 511:
print >> sys.stderr, "Will try again in a moment. Be patient!"
time.sleep(5.0)
continue
pass
return (-1, None)
except xmlrpclib.ProtocolError, e:
if not quiet: print >> sys.stderr, e.errmsg
return (-1, None)
except M2Crypto.SSL.Checker.WrongHost, e:
if not quiet:
print >> sys.stderr, "Warning: certificate host name mismatch."
print >> sys.stderr, "Please consult:"
print >> sys.stderr, " http://www.protogeni.net/trac/protogeni/wiki/HostNameMismatch"
print >> sys.stderr, "for recommended solutions."
print >> sys.stderr, e
pass
return (-1, None)
pass
except xmlrpclib.Fault, e:
if not quiet: print >> sys.stderr, e.faultString
return (-1, None)
except xmlrpclib.ProtocolError, e:
if not quiet: print >> sys.stderr, e.errmsg
return (-1, None)
except M2Crypto.SSL.Checker.WrongHost, e:
if not quiet:
print >> sys.stderr, "Warning: certificate host name mismatch."
print >> sys.stderr, "Please consult:"
print >> sys.stderr, " http://www.protogeni.net/trac/protogeni/wiki/HostNameMismatch"
print >> sys.stderr, "for recommended solutions."
print >> sys.stderr, e
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment