python3: Fix traceback while running unit tests
While running unit tests with python3, we get the following traceback: TypeError: 'map' object is not subscriptable In python3, a map returns an iterable object of type map, and is not subscriptable. Refactor to not use indicies so that it is python2 and python3 compat. blueprint python3-novaclient Change-Id: Iaf0de19f08fa3e91ee79c174ccc86a8bbe4acdc8 Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
parent
cab4617225
commit
4f3c2c92a4
@ -2396,7 +2396,7 @@ def do_usage_list(cs, args):
|
||||
end = now + datetime.timedelta(days=1)
|
||||
|
||||
def simplify_usage(u):
|
||||
simplerows = map(lambda x: x.lower().replace(" ", "_"), rows)
|
||||
simplerows = [x.lower().replace(" ", "_") for x in rows]
|
||||
|
||||
setattr(u, simplerows[0], u.tenant_id)
|
||||
setattr(u, simplerows[1], "%d" % len(u.server_usages))
|
||||
@ -2442,7 +2442,7 @@ def do_usage(cs, args):
|
||||
end = now + datetime.timedelta(days=1)
|
||||
|
||||
def simplify_usage(u):
|
||||
simplerows = map(lambda x: x.lower().replace(" ", "_"), rows)
|
||||
simplerows = [x.lower().replace(" ", "_") for x in rows]
|
||||
|
||||
setattr(u, simplerows[0], "%d" % len(u.server_usages))
|
||||
setattr(u, simplerows[1], "%.2f" % u.total_memory_mb_usage)
|
||||
|
Loading…
x
Reference in New Issue
Block a user