]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: viewcache: remove VALUE_EXCEPTION
authorRicardo Dias <rdias@suse.com>
Mon, 26 Mar 2018 11:01:06 +0000 (12:01 +0100)
committerRicardo Dias <rdias@suse.com>
Fri, 13 Apr 2018 14:58:43 +0000 (15:58 +0100)
Instead of returning the exception object as a result of a function
decorated with `@ViewCache()`, raise the exception in the function
caller thread.

Signed-off-by: Ricardo Dias <rdias@suse.com>
src/pybind/mgr/dashboard/tools.py

index 1e99dd7a78b172028b275d9cf1774fd1f141761f..7c05e1a098b215c40baae71ec32dab142a8319a4 100644 (file)
@@ -101,7 +101,6 @@ class ViewCache(object):
     VALUE_OK = 0
     VALUE_STALE = 1
     VALUE_NONE = 2
-    VALUE_EXCEPTION = 3
 
     class GetterThread(threading.Thread):
         def __init__(self, view, fn, args, kwargs):
@@ -184,7 +183,8 @@ class ViewCache(object):
                     # We fetched the data within the timeout
                     if self.exception:
                         # execution raised an exception
-                        return ViewCache.VALUE_EXCEPTION, self.exception
+                        # pylint: disable=raising-bad-type
+                        raise self.exception
                     return ViewCache.VALUE_OK, self.value
                 elif self.value_when is not None:
                     # We have some data, but it doesn't meet freshness requirements