xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Klose <doko@debian.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen@packages.debian.org, xen-devel@lists.xensource.com
Subject: Re: [Pkg-xen-devel] using xen tools with python2.6
Date: Tue, 14 Sep 2010 17:55:43 +0200	[thread overview]
Message-ID: <4C8F9AFF.1030504@debian.org> (raw)
In-Reply-To: <1284369251.14311.14322.camel@zakaz.uk.xensource.com>

[-- Attachment #1: Type: text/plain, Size: 1781 bytes --]

On 13.09.2010 11:14, Ian Campbell wrote:
> On Mon, 2010-09-13 at 10:57 +0200, Matthias Klose wrote:
>> On 13.09.2010 10:38, Ian Campbell wrote:
>>> On Sun, 2010-09-12 at 16:25 +0200, Matthias Klose wrote:
>>>> 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.
>>>
>>> Thanks Matthias.
>>>
>>>>     - 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.
>>>
>>> Why is the first one potentially unsafe?
>>
>> because I didn't check where it's used.
>>
>>> What do you mean by "not catched" here? Just that nothing catches the
>>> exception?
>>
>> yes, and the first one seems to match this definition too.
>
> I suspect so too, I think these changes are good.
>>
>>> Please could you provide a Signed-off-by line for upstream?
>>
>> hmm, any pointers? I hope my friendly distribution packager could help ...
>
> As with the Linux kernel Xen requires that contributions are signed off
> to indicate that the code is suitable (copyright-wise etc) for inclusion
> in Xen. e.g.
>     Signed-off-by: Ian Campbell<ian.campbell@eu.citrix.com>
> except with your name and email address.
>
> You can find the precise meaning in the Linux
> upstream kernel tree (Documentation/SubmittingPatches, copy below).

thanks, attached the patch with this line added.

    Matthias


[-- Attachment #2: tools-python2.6.diff --]
[-- Type: text/plain, Size: 1955 bytes --]

Description: Replace python string exceptions with ValueError exceptions
Author: Matthias Klose <doko@debian.org>
Bug-Debian: http://bugs.debian.org/585372
Signed-off-by: Matthias Klose <doko@debian.org>

--- 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 = {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2010-09-14 15:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-12 14:25 using xen tools with python2.6 Matthias Klose
2010-09-13  8:38 ` [Pkg-xen-devel] " Ian Campbell
2010-09-13  8:57   ` Matthias Klose
2010-09-13  9:14     ` Ian Campbell
2010-09-14 15:55       ` Matthias Klose [this message]
     [not found]   ` <m2n.s.1OvAmk-0012nR@chiark.greenend.org.uk>
2010-09-14 16:46     ` Ian Jackson
2010-09-15  8:38       ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C8F9AFF.1030504@debian.org \
    --to=doko@debian.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=xen@packages.debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).