compute: fixes python 3 related unit tests
Fixes volume related unit tests. Fixes non-sortable None items. Fixes __getattr__ infinite recursion. Fixes is_dict_like method. Dicts in python 3.4 do not have the 'has_key' method. Partially Implements: blueprint goal-python35 Change-Id: I97efc09f7657436f706b08e0b2795f0e59ac1dcd
This commit is contained in:
@@ -541,7 +541,9 @@ def instance_block_mapping(instance, bdms):
|
||||
# Right now sort by device name for deterministic
|
||||
# result.
|
||||
if ebs_devices:
|
||||
ebs_devices.sort()
|
||||
# NOTE(claudiub): python2.7 sort places None values first.
|
||||
# this sort will maintain the same behaviour for both py27 and py34.
|
||||
ebs_devices = sorted(ebs_devices, key=lambda x: (x is not None, x))
|
||||
for nebs, ebs in enumerate(ebs_devices):
|
||||
mappings['ebs%d' % nebs] = ebs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user