From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Klose Subject: using xen tools with python2.6 Date: Sun, 12 Sep 2010 16:25:01 +0200 Message-ID: <4C8CE2BD.2000404@debian.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060609080301080202000502" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com, xen@packages.debian.org List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------060609080301080202000502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 ValueError's. - 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 ValueError's seems to be safe. Matthias --------------060609080301080202000502 Content-Type: text/plain; name="tools-python2.6.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tools-python2.6.diff" Description: Replace python string exceptions with ValueError exceptions Author: Matthias Klose Bug-Debian: http://bugs.debian.org/585372 --- xen-4.0.1.orig/tools/python/xen/util/bugtool.py +++ xen-4.0.1/tools/python/xen/util/bugtool.py @@ -139,7 +139,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): --- xen-4.0.1.orig/tools/python/xen/xend/XendBase.py +++ xen-4.0.1/tools/python/xen/xend/XendBase.py @@ -114,7 +114,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()) --- xen-4.0.1.orig/tools/python/xen/xm/xenapi_create.py +++ xen-4.0.1/tools/python/xen/xm/xenapi_create.py @@ -702,7 +702,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 --- xen-4.0.1.orig/tools/python/xen/xm/main.py +++ xen-4.0.1/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 = { --------------060609080301080202000502 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------060609080301080202000502--