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):
|
def _volume_attached(self, volume_id):
|
||||||
volume_item = self.cinder_client.volumes.get(volume_id)
|
volume_item = self.cinder_client.volumes.get(volume_id)
|
||||||
server_attachments = filter(lambda x: x['server_id'] == self.id,
|
server_attachments = list(filter(lambda x: x['server_id'] == self.id,
|
||||||
volume_item.attachments)
|
volume_item.attachments))
|
||||||
if len(server_attachments) > 0:
|
if len(server_attachments) > 0:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -287,8 +287,8 @@ class Server(object):
|
||||||
|
|
||||||
def _volume_detached(self, volume_id):
|
def _volume_detached(self, volume_id):
|
||||||
volume_item = self.cinder_client.volumes.get(volume_id)
|
volume_item = self.cinder_client.volumes.get(volume_id)
|
||||||
server_attachments = filter(lambda x: x['server_id'] == self.id,
|
server_attachments = list(filter(lambda x: x['server_id'] == self.id,
|
||||||
volume_item.attachments)
|
volume_item.attachments))
|
||||||
if len(server_attachments) > 0:
|
if len(server_attachments) > 0:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -127,7 +127,7 @@ class ScheduledOperationsTest(karbor_base.KarborBaseTest):
|
||||||
operation_item = self.karbor_client.scheduled_operations.get(
|
operation_item = self.karbor_client.scheduled_operations.get(
|
||||||
operation.id)
|
operation.id)
|
||||||
plan_id = operation_item.operation_definition["plan_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))
|
self.assertEqual(freq, len(cps))
|
||||||
|
|
||||||
for cp in cps:
|
for cp in cps:
|
||||||
|
|
Loading…
Reference in New Issue