diff options
author | Keir Fraser <keir@xen.org> | 2010-12-17 17:56:00 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2010-12-17 17:56:00 +0000 |
commit | 0979a8362a9a00900f6c3ff5031eb873de344295 (patch) | |
tree | 8b26bd4284811cd55be90becb786b1c9e1d76be3 /tools | |
parent | 65421fd842977f64a7870f2b8989d02c23b903a3 (diff) | |
download | xen-0979a8362a9a00900f6c3ff5031eb873de344295.tar.gz xen-0979a8362a9a00900f6c3ff5031eb873de344295.tar.bz2 xen-0979a8362a9a00900f6c3ff5031eb873de344295.zip |
tools/python: Replace python string exceptions with ValueError exceptions
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/util/bugtool.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xend/XendBase.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xm/main.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xm/xenapi_create.py | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/tools/python/xen/util/bugtool.py b/tools/python/xen/util/bugtool.py index 18569dcb33..e8d96b884a 100644 --- a/tools/python/xen/util/bugtool.py +++ b/tools/python/xen/util/bugtool.py @@ -141,7 +141,7 @@ def getBugTitle(bug): 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): diff --git a/tools/python/xen/xend/XendBase.py b/tools/python/xen/xend/XendBase.py index 73fed471dc..924477669a 100644 --- a/tools/python/xen/xend/XendBase.py +++ b/tools/python/xen/xend/XendBase.py @@ -115,7 +115,7 @@ class XendBase: # 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()) diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 817a4df512..30328c18c9 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -2616,7 +2616,7 @@ def xm_network_attach(args): 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 = { diff --git a/tools/python/xen/xm/xenapi_create.py b/tools/python/xen/xm/xenapi_create.py index f53a1770fd..eea256e74a 100644 --- a/tools/python/xen/xm/xenapi_create.py +++ b/tools/python/xen/xm/xenapi_create.py @@ -703,7 +703,7 @@ class sxp2xml: 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 |