From: Sebastian Wagner Date: Thu, 11 Jun 2020 12:12:57 +0000 (+0200) Subject: mgr/test_orchestrator: Provide proper get_hosts_func X-Git-Tag: v16.1.0~2069^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F35474%2Fhead;p=ceph.git mgr/test_orchestrator: Provide proper get_hosts_func Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index d7ef5d5bcc79..3fcc5f20c0df 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(