Merge "Fix 'filter' object has no len ()"
This commit is contained in:
commit
4bbc17595f
|
@ -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:
|
||||
|
|
|
@ -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…
Reference in New Issue