There are at least some syntax errors when trying to use the xen utils
with python2.6. The attached patch changes these string exception
into ValueErrors:
- tools/python/xen/util/bugtool.py (getBugTitle)
- tools/python/xen/xend (class XendBase): not catched
- tools/python/xen/xm/xenapi_create.py (sxp2xmlconvert_sxp_to_xml):
the method already raises a ValueError for similiar condition.
- tools/python/xen/xm/main.py (xm_network_attach): not catched.
For all but maybe the first one, the replacement of the string
exceptions into ValueErrors seems to be safe.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset: 22153:
95c90bd63aed
xen-unstable date: Tue Sep 14 17:46:21 2010 +0100
finally:
f.close()
- raise "Could not find title of bug %d!" % bug
+ raise ValueError("Could not find title of bug %d!" % bug)
def send(bug, conn, fd, filename, username, password):
# In OSS, ref == uuid
return uuid
else:
- raise "Big Error.. TODO!"
+ raise ValueError("Big Error.. TODO!")
def get_all_records(cls):
return dict([(inst.get_uuid(), inst.get_record())
for ref, record in server.xenapi.network
.get_all_records().items()])
if bridge not in networks.keys():
- raise "Unknown bridge name!"
+ raise ValueError("Unknown bridge name!")
return networks[bridge]
vif_conv = {
vm.attributes['security_label'] = \
security.set_security_label(sec_data[0][1][1],sec_data[0][2][1])
except Exception, e:
- raise "Invalid security data format: %s" % str(sec_data)
+ raise ValueError("Invalid security data format: %s" % str(sec_data))
# Make the name tag