Fix 'filter' object is not subscriptable

nova-lxd has a python3 compatibility issue where it will fail with:
TypeError: 'filter' object is not subscriptable

This patch corrects that problem.

Change-Id: Iaa275eb770bca53fac2aae201cc5597e660c64df
Related-Bug: #1815325
This commit is contained in:
Michael Johnson 2019-02-10 10:23:38 -08:00 committed by Alex Kavanagh (tinwood)
parent 1060782cbf
commit 8ee2979084
2 changed files with 3 additions and 2 deletions

View File

@ -90,4 +90,4 @@ export DEVSTACK_GATE_TEMPEST_REGEX="$r"
# set the concurrency to 1 for devstack-gate
# See: https://bugs.launchpad.net/nova-lxd/+bug/1790943
export TEMPEST_CONCURRENCY=1
# export TEMPEST_CONCURRENCY=1

View File

@ -1259,7 +1259,8 @@ class LXDDriver(driver.ComputeDriver):
"""
container_id_map = json.loads(
container.config['volatile.last_state.idmap'])
uid_map = filter(lambda id_map: id_map.get("Isuid"), container_id_map)
uid_map = list(filter(lambda id_map: id_map.get("Isuid"),
container_id_map))
if uid_map:
storage_id = uid_map[0].get("Hostid", 0)
else: