From 2df65be823245a8eb8f8e32d9d1818b8fb34e6ca Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Mon, 26 Mar 2018 12:01:06 +0100 Subject: [PATCH] mgr/dashboard: viewcache: remove VALUE_EXCEPTION 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 --- src/pybind/mgr/dashboard/tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/tools.py b/src/pybind/mgr/dashboard/tools.py index 1e99dd7a78b..7c05e1a098b 100644 --- a/src/pybind/mgr/dashboard/tools.py +++ b/src/pybind/mgr/dashboard/tools.py @@ -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 -- 2.39.5