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: Ib2208fdc2289b6a52e5ad41ca540c75e9d1d94b4
Closes-Bug: #1815325
This commit is contained in:
Michael Johnson 2019-02-10 10:23:38 -08:00
parent 0ea07af2a2
commit 15cdfc071b
1 changed files with 2 additions and 1 deletions

View File

@ -1275,7 +1275,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: