From bb611c64ee5120272215683b4b5ac4397f9c5ea6 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 --- 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 9f3b2bf6f3b..14b7dfdacfc 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -646,6 +646,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' @@ -660,6 +662,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.39.5