]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/ceph_manager.py: do not return a filter
authorKefu Chai <kchai@redhat.com>
Tue, 7 Apr 2020 16:45:49 +0000 (00:45 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 8 Apr 2020 03:02:29 +0000 (11:02 +0800)
as the caller might want to `len(manager.get_osd_status()['raw'])`, and
`len()` does not accept a `filter` object.

also, the filtered osd statuses are printed out using `self.log()`, so
we should materialize the `filter` object before sending it to logging
facility. otherwise we will have something like:
```
2020-04-08T02:58:37.001 INFO:tasks.ceph.ceph_manager.ceph:<filter object at 0x7f5a080e1518>
```
in the logging message.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/ceph_manager.py

index 9ba9725932fc2c9c08e52121f6adfa8cca39bc8e..c058735aa8a27d9aee0b0a5869e62ee0f37f1e30 100644 (file)
@@ -1820,9 +1820,9 @@ class CephManager:
         """
         Get osd statuses sorted by states that the osds are in.
         """
-        osd_lines = filter(
+        osd_lines = list(filter(
             lambda x: x.startswith('osd.') and (("up" in x) or ("down" in x)),
-            self.raw_osd_status().split('\n'))
+            self.raw_osd_status().split('\n')))
         self.log(osd_lines)
         in_osds = [int(i[4:].split()[0])
                    for i in filter(lambda x: " in " in x, osd_lines)]