Merge "Drop workarounds for python2.6"
This commit is contained in:
@@ -719,11 +719,7 @@ class ResourceExceptionHandler(object):
|
||||
raise Fault(exception.ConvertedException(
|
||||
code=ex_value.code,
|
||||
explanation=ex_value.format_message()))
|
||||
|
||||
# Under python 2.6, TypeError's exception value is actually a string,
|
||||
# so test # here via ex_type instead:
|
||||
# http://bugs.python.org/issue7853
|
||||
elif issubclass(ex_type, TypeError):
|
||||
elif isinstance(ex_value, TypeError):
|
||||
exc_info = (ex_type, ex_value, ex_traceback)
|
||||
LOG.error(_LE('Exception handling resource: %s'), ex_value,
|
||||
exc_info=exc_info)
|
||||
|
||||
@@ -99,14 +99,10 @@ class VHDUtilsV2(vhdutils.VHDUtils):
|
||||
image_man_svc = self._conn.Msvm_ImageManagementService()[0]
|
||||
vhd_info_xml = self._get_vhd_info_xml(image_man_svc, child_vhd_path)
|
||||
|
||||
# Can't use ".//PROPERTY[@NAME='ParentPath']/VALUE" due to
|
||||
# compatibility requirements with Python 2.6
|
||||
et = ElementTree.fromstring(vhd_info_xml)
|
||||
for item in et.findall("PROPERTY"):
|
||||
name = item.attrib["NAME"]
|
||||
if name == 'ParentPath':
|
||||
item.find("VALUE").text = parent_vhd_path
|
||||
break
|
||||
item = et.find(".//PROPERTY[@NAME='ParentPath']/VALUE")
|
||||
if item:
|
||||
item.text = parent_vhd_path
|
||||
vhd_info_xml = ElementTree.tostring(et)
|
||||
|
||||
(job_path, ret_val) = image_man_svc.SetVirtualHardDiskSettingData(
|
||||
|
||||
@@ -1040,9 +1040,7 @@ def propset_dict(propset):
|
||||
if propset is None:
|
||||
return {}
|
||||
|
||||
# TODO(hartsocks): once support for Python 2.6 is dropped
|
||||
# change to {[(prop.name, prop.val) for prop in propset]}
|
||||
return dict([(prop.name, prop.val) for prop in propset])
|
||||
return {prop.name: prop.val for prop in propset}
|
||||
|
||||
|
||||
def get_vmdk_backed_disk_uuid(hardware_devices, volume_uuid):
|
||||
|
||||
Reference in New Issue
Block a user