Changeset 9d3e646


Ignore:
Timestamp:
Dec 3, 2008 9:41:58 AM (16 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
375ca67
Parents:
46a0f7a
Message:

Differentiate between a failure to connect to a service and the service being
provided using an unexpected protocol. Deal with the internal connection error
more cleanly when the connection is being made to an internal service. That
is, when an internal service is down, propagate a clean error out to the
caller. Before this change, the internal service failure would look like a
protocol error on the external service (SOAP being provided by XMLRPC, for
example) and try the other protocol, which would fail with a misleading error.

Location:
fedd
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_types.xsd

    r46a0f7a r9d3e646  
    638638          <xsd:enumeration value="6"/>  <!-- partial instantiation -->
    639639          <xsd:enumeration value="7"/>  <!-- federant error -->
     640          <xsd:enumeration value="8"/>  <!-- connect error -->
    640641        </xsd:restriction>
    641642      </xsd:element>
  • fedd/federation/allocate_project.py

    r46a0f7a r9d3e646  
    499499                req = req[self.request_body_name]
    500500            else:
    501                 print "request error"
    502501                raise service_error(service_error.req, "Bad formated request");
    503502
    504             r = self.call_service(self.url, req, self.cert_file, self.cert_pwd,
    505                     self.trusted_certs)
     503            try:
     504                r = self.call_service(self.url, req, self.cert_file,
     505                        self.cert_pwd, self.trusted_certs)
     506            except service_error, e:
     507                if e.code == service_error.connect:
     508                    raise service_error(service_error.internal,
     509                            "Cannot connect to internal service: (%d) %s" % \
     510                                    (e.code, e.desc))
     511                else: raise
    506512            if r.has_key(self.resp_name):
    507513                return r[self.resp_name]
    508514            else:
    509                 print "response error"
    510515                raise service_error(service_error.protocol,
    511516                        "Bad proxy response")
  • fedd/federation/remote_service.py

    r46a0f7a r9d3e646  
    346346                    { self.request_body_name: r}, self.encap_fedids))
    347347        except socket_error, e:
    348             raise service_error(service_error.protocol,
     348            raise service_error(service_error.connect,
    349349                    "Cannot connect to %s: %s" % (url, e[1]))
    350350        except SSLError, e:
    351             raise service_error(service_error.protocol,
     351            raise service_error(service_error.connect,
    352352                    "SSL error contacting %s: %s" % (url, e.message))
    353353        except Fault, f:
     
    407407            resp = remote_method(msg)
    408408        except socket_error, e:
    409             raise service_error(service_error.protocol,
     409            raise service_error(service_error.connect,
    410410                    "Cannot connect to %s: %s" % (url, e[1]))
    411411        except SSLError, e:
    412             raise service_error(service_error.protocol,
     412            raise service_error(service_error.connect,
    413413                    "SSL error contacting %s: %s" % (url, e.message))
    414414        except ParseException, e:
  • fedd/federation/service_error.py

    r46a0f7a r9d3e646  
    1212    partial = 6
    1313    federant = 7
     14    connect = 8
    1415    code_str = {
    1516        access : "Access Denied",
     
    1819        server_config: "Server Configuration Error",
    1920        internal : "Internal Error",
    20         partial: "Partial embedding",
    21         federant: "Federant error"
     21        partial: "Partial Embedding",
     22        federant: "Federant Error",
     23        connect: "Connection Error",
    2224    }
    2325    str_code = dict([ (v, k) for k, v in code_str.iteritems() ])
    24     client_errors = ( req )
    25     server_errors = ( access, protocol, server_config, internal)
     26    client_errors = ( req, partial)
     27    server_errors = ( access, protocol, server_config, internal,
     28            federant, connect)
    2629
    2730    def __init__(self, code=None, desc=None, from_string=None):
Note: See TracChangeset for help on using the changeset viewer.