From c3d1d2d9197e9bd2529f6802b58288069fa675d5 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Sat, 3 Feb 2018 22:05:02 +0800 Subject: [PATCH] pybind/mgr/balancer: fix sanity check against empty weight-set There are paths get_compat_weight_set_weights() will return a empty dict, not None. Signed-off-by: xie xingguo (cherry picked from commit f10696e7e1026a7de434325fb2caebe23704db14) --- src/pybind/mgr/balancer/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 4b85d65014ffa..359d946d00489 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -674,7 +674,7 @@ class Module(MgrModule): # get current compat weight-set weights orig_ws = self.get_compat_weight_set_weights(ms) - if orig_ws is None: + if not orig_ws: return False orig_ws = { a: b for a, b in orig_ws.iteritems() if a >= 0 } -- 2.39.5