]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/test_orchestrator: Provide proper get_hosts_func 35474/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Thu, 11 Jun 2020 12:12:57 +0000 (14:12 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 11 Jun 2020 12:12:57 +0000 (14:12 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/test_orchestrator/module.py

index d7ef5d5bcc7978344134facd43be171fd5a790f7..3fcc5f20c0df7e094cc97761524fbf9d2131fbe6 100644 (file)
@@ -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(