Fix access-rule filter for python3
The manila-tempest-plugin shares client collects access rules from a rest response body using a filter expression which in Python 3 is an iterator. It then attempts to determine the length of the result and since the full iteration has not completed, Python throws an exception. Fix this by using a straightforward list comprehension that behaves the same way in Python 2 and Python 3. Closes-bug: #1810937 Change-Id: I20a1f05cd4e2f6bdee8b8e4b069c53e35e41fe70
This commit is contained in:
parent
f9d49aba02
commit
e5d788e46f
|
@ -1663,7 +1663,7 @@ class SharesV2Client(shares_client.SharesClient):
|
|||
resp, body = self.get("snapshots/%s/access-list" % snapshot_id,
|
||||
version=LATEST_MICROVERSION)
|
||||
body = self._parse_resp(body)
|
||||
found_rules = filter(lambda x: x['id'] == rule_id, body)
|
||||
found_rules = [r for r in body if r['id'] == rule_id]
|
||||
|
||||
return found_rules[0] if len(found_rules) > 0 else None
|
||||
|
||||
|
|
Loading…
Reference in New Issue