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
diff --git a/manila_tempest_tests/services/share/v2/json/shares_client.py b/manila_tempest_tests/services/share/v2/json/shares_client.py
index 522d467..a5a816a 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -1663,7 +1663,7 @@
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