From 7dca1c1ff80d1dd6f30a2ee57ed2fe0a46f8a454 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 29 Jan 2021 10:40:44 -0600 Subject: [PATCH] mgr/devicehealth: make CLI commands error when pool doesn't exist This is better than silently failing to do anything. Signed-off-by: Sage Weil (cherry picked from commit db31d09efa60fad98429b1ec7e0d30188f355035) --- src/pybind/mgr/devicehealth/module.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 4983a22404c..5009820b615 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -321,7 +321,7 @@ class Module(MgrModule): def scrape_daemon(self, daemon_type, daemon_id): ioctx = self.open_connection() if not ioctx: - return 0, "", "" + return -errno.EAGAIN, "", "device_health_metrics pool not yet available" raw_smart_data = self.do_scrape_daemon(daemon_type, daemon_id) if raw_smart_data: for device, raw_data in raw_smart_data.items(): @@ -336,7 +336,7 @@ class Module(MgrModule): assert osdmap is not None ioctx = self.open_connection() if not ioctx: - return 0, "", "" + return -errno.EAGAIN, "", "device_health_metrics pool not yet available" did_device = {} ids = [] for osd in osdmap['osds']: @@ -370,7 +370,7 @@ class Module(MgrModule): (daemon_type, daemon_id) = daemons[0].split('.') ioctx = self.open_connection() if not ioctx: - return 0, "", "" + return -errno.EAGAIN, "", "device_health_metrics pool not yet available" raw_smart_data = self.do_scrape_daemon(daemon_type, daemon_id, devid=devid) if raw_smart_data: -- 2.47.3