From c57027c7ef8d8117161db0f05000d9a4df3d75ba Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 8 Nov 2019 10:29:17 -0600 Subject: [PATCH] mgr/ssh: handle lack of node hints more gracefully RuntimeError: Remote method threw exception: TypeError: object of type 'NoneType' has no len() isn't friendly Signed-off-by: Sage Weil --- src/pybind/mgr/ssh/module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 5e8ea6639fe3..07f4f1b0f45c 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -990,7 +990,7 @@ class SSHOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): return SSHWriteCompletion(results) def add_mds(self, spec): - if len(spec.placement.nodes) < spec.count: + if not spec.placement.nodes or len(spec.placement.nodes) < spec.count: raise RuntimeError("must specify at least %d hosts" % spec.count) daemons = self._get_services('mds') results = [] @@ -1040,7 +1040,7 @@ class SSHOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): return SSHWriteCompletion(results) def add_rgw(self, spec): - if len(spec.placement.nodes) < spec.count: + if not spec.placement.nodes or len(spec.placement.nodes) < spec.count: raise RuntimeError("must specify at least %d hosts" % spec.count) # ensure rgw_zone is set for these daemons ret, out, err = self.mon_command({ -- 2.47.3