blockdevice.py: python3 fixes

keys() is an iterator in python3, so we need to make it list before
finding the first element

Change-Id: Ic158c7b2901c1a34ff417d3432fcefed4760ce24
This commit is contained in:
Ian Wienand 2017-03-13 19:28:05 +11:00
parent 8b19f7f99d
commit b04c58eca4

View File

@ -133,7 +133,7 @@ class BlockDevice(object):
raise BlockDeviceSetupException( raise BlockDeviceSetupException(
"Top level config must contain exactly one key per entry") "Top level config must contain exactly one key per entry")
logger.debug("Config entry [%s]" % config_entry) logger.debug("Config entry [%s]" % config_entry)
cfg_obj_name = config_entry.keys()[0] cfg_obj_name = list(config_entry.keys())[0]
cfg_obj_val = config_entry[cfg_obj_name] cfg_obj_val = config_entry[cfg_obj_name]
# As the first step the configured objects are created # As the first step the configured objects are created