From 72aa680aa650b874e7db838cf606ce24e0594be8 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 27 Jan 2021 14:58:01 +0800 Subject: [PATCH] mgr/devicehealth: return -1 if prediction plugin is not available Signed-off-by: Kefu Chai (cherry picked from commit bb611c64ee5120272215683b4b5ac4397f9c5ea6) --- src/pybind/mgr/devicehealth/module.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 052ccaf79bd..830003859c8 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -660,6 +660,8 @@ class Module(MgrModule): can_run, _ = self.remote(plugin_name, 'can_run') if can_run: return self.remote(plugin_name, 'predict_life_expectancy', devid=devid) + else: + return -1, '', f'{plugin_name} is not available' except: return -1, '', 'unable to invoke diskprediction local or remote plugin' @@ -674,6 +676,8 @@ class Module(MgrModule): can_run, _ = self.remote(plugin_name, 'can_run') if can_run: return self.remote(plugin_name, 'predict_all_devices') + else: + return -1, '', f'{plugin_name} is not available' except: return -1, '', 'unable to invoke diskprediction local or remote plugin' -- 2.47.3