diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-01-29 16:19:30 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-01-29 16:19:30 -0500 |
commit | b3c5591d70c1c354d14267e804ab64872af97b40 (patch) | |
tree | a361f4d0ea060df23ffbccf9961f38bb01a65d23 /func/minion/server.py | |
parent | 1d60f197dab809e9a51c3377587d46370e698c52 (diff) | |
download | func-b3c5591d70c1c354d14267e804ab64872af97b40.tar.gz func-b3c5591d70c1c354d14267e804ab64872af97b40.tar.xz func-b3c5591d70c1c354d14267e804ab64872af97b40.zip |
All exceptions, async or otherwise, now come back as easily detectable signatures. Use utils.is_error(result)
to determine if something is an error or isn't. Example scripts as well as func-inventory have been updated.
See async_test.py for examples.
Diffstat (limited to 'func/minion/server.py')
-rwxr-xr-x | func/minion/server.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/func/minion/server.py b/func/minion/server.py index 7187783..7a760a0 100755 --- a/func/minion/server.py +++ b/func/minion/server.py @@ -131,11 +131,12 @@ class FuncApiMethod: rc = self.__method(*args) except codes.FuncException, e: self.__log_exc() - rc = e + (t, v, tb) = sys.exc_info() + rc = utils.nice_exception(t,v,tb) except: - self.logger.debug("Not a Func-specific exception") self.__log_exc() - raise + (t, v, tb) = sys.exc_info() + rc = utils.nice_exception(t,v,tb) self.logger.debug("Return code for %s: %s" % (self.__name, rc)) return rc @@ -218,11 +219,15 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer, sub_hash = peer_cert.subject_name_hash() self.audit_logger.log_call(ip, cn, sub_hash, method, params) - if not async_dispatch: - return self.get_dispatch_method(method)(*params) - else: - meth = self.get_dispatch_method(method) - return jobthing.minion_async_run(meth, params) + try: + if not async_dispatch: + return self.get_dispatch_method(method)(*params) + else: + return jobthing.minion_async_run(self.get_dispatch_method, method, params) + except: + (t, v, tb) = sys.exc_info() + rc = utils.nice_exception(t, v, tb) + return rc def auth_cb(self, request, client_address): peer_cert = request.get_peer_certificate() |