Browse Source

Merge "Fix 'filter' object has no len ()"

stable/victoria
Zuul 7 months ago
committed by Gerrit Code Review
parent
commit
4bbc17595f
2 changed files with 5 additions and 5 deletions
  1. +4
    -4
      karbor/tests/fullstack/karbor_objects.py
  2. +1
    -1
      karbor/tests/fullstack/test_scheduled_operations.py

+ 4
- 4
karbor/tests/fullstack/karbor_objects.py View File

@ -273,8 +273,8 @@ class Server(object):
def _volume_attached(self, volume_id):
volume_item = self.cinder_client.volumes.get(volume_id)
server_attachments = filter(lambda x: x['server_id'] == self.id,
volume_item.attachments)
server_attachments = list(filter(lambda x: x['server_id'] == self.id,
volume_item.attachments))
if len(server_attachments) > 0:
return True
else:
@ -287,8 +287,8 @@ class Server(object):
def _volume_detached(self, volume_id):
volume_item = self.cinder_client.volumes.get(volume_id)
server_attachments = filter(lambda x: x['server_id'] == self.id,
volume_item.attachments)
server_attachments = list(filter(lambda x: x['server_id'] == self.id,
volume_item.attachments))
if len(server_attachments) > 0:
return False
else:


+ 1
- 1
karbor/tests/fullstack/test_scheduled_operations.py View File

@ -127,7 +127,7 @@ class ScheduledOperationsTest(karbor_base.KarborBaseTest):
operation_item = self.karbor_client.scheduled_operations.get(
operation.id)
plan_id = operation_item.operation_definition["plan_id"]
cps = filter(lambda x: x.protection_plan["id"] == plan_id, items)
cps = list(filter(lambda x: x.protection_plan["id"] == plan_id, items))
self.assertEqual(freq, len(cps))
for cp in cps:


Loading…
Cancel
Save