From 44cacc54c1582f83cec4caa6c38d35e8bc1be093 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Thu, 11 Jun 2020 14:12:57 +0200 Subject: [PATCH] mgr/test_orchestrator: Provide proper get_hosts_func Signed-off-by: Sebastian Wagner --- src/pybind/mgr/test_orchestrator/module.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index d7ef5d5bcc797..3fcc5f20c0df7 100644 --- a/src/pybind/mgr/test_orchestrator/module.py +++ b/src/pybind/mgr/test_orchestrator/module.py @@ -258,8 +258,13 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator): def run(all_hosts): # type: (List[orchestrator.HostSpec]) -> None drive_group.validate() - if not drive_group.placement.filter_matching_hosts(lambda label=None, as_hostspec=None: - [h.hostname for h in all_hosts]): + + def get_hosts_func(label=None, as_hostspec=False): + if as_hostspec: + return all_hosts + return [h.hostname for h in all_hosts] + + if not drive_group.placement.filter_matching_hosts(get_hosts_func): raise orchestrator.OrchestratorValidationError('failed to match') return self.get_hosts().then(run).then( @@ -276,8 +281,13 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator): def run(all_hosts): # type: (List[orchestrator.HostSpec]) -> None drive_group.validate() - if not drive_group.placement.filter_matching_hosts(lambda label=None, as_hostspec=None: - [h.hostname for h in all_hosts]): + + def get_hosts_func(label=None, as_hostspec=False): + if as_hostspec: + return all_hosts + return [h.hostname for h in all_hosts] + + if not drive_group.placement.filter_matching_hosts(get_hosts_func): raise orchestrator.OrchestratorValidationError('failed to match') return self.get_hosts().then(run).then( on_complete=orchestrator.ProgressReference( -- 2.39.5