Merge "Drop workarounds for python2.6"

This commit is contained in:
Jenkins
2015-01-05 18:52:03 +00:00
committed by Gerrit Code Review
3 changed files with 5 additions and 15 deletions
+1 -5
View File
@@ -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)
+3 -7
View File
@@ -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(
+1 -3
View File
@@ -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):