using xen tools with python2.6
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
Description: Replace python string exceptions with ValueError exceptions
Author: Matthias Klose <[email protected]>
Bug-Debian: http://bugs.debian.org/585372
tools/python/xen/util/bugtool.py +1 -1
@@ -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):
tools/python/xen/xend/XendBase.py +1 -1
@@ -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())
tools/python/xen/xm/xenapi_create.py +1 -1
@@ -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
tools/python/xen/xm/main.py +1 -1
@@ -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 = {
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Matthias Klose
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.
Quoted 8 lines
-
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?
What do you mean by "not catched" here? Just that nothing catches the exception?
Please could you provide a Signed-off-by line for upstream?
Ian.
Description: Replace python string exceptions with ValueError exceptions
Author: Matthias Klose <[email protected]>
Bug-Debian: http://bugs.debian.org/585372
tools/python/xen/util/bugtool.py +1 -1
@@ -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):
tools/python/xen/xend/XendBase.py +1 -1
@@ -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())
tools/python/xen/xm/xenapi_create.py +1 -1
@@ -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
tools/python/xen/xm/main.py +1 -1
@@ -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 = {
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Matthias Klose
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.
Quoted 6 lines
-
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.
Quoted 4 lines
Quoted 2 lines
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.
Quoted 2 lines
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.
Quoted 1 line
Please could you provide a Signed-off-by line for upstream?
hmm, any pointers? I hope my friendly distribution packager could help ...
Matthias
Quoted 16 lines · Matthias Klose
Quoted 15 lines · Ian Campbell
Quoted 2 lines · Matthias Klose
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.
Quoted 8 lines
-
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.
Quoted 8 lines
Quoted 1 line
Why is the first one potentially unsafe?
because I didn't check where it's used.
Quoted 2 lines
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.
Quoted 4 lines
Quoted 2 lines
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.
except with your name and email address.
You can find the precise meaning in the Linux
upstream kernel tree (Documentation/SubmittingPatches, copy below).
Ian.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
Quoted 32 lines · Ian Campbell
Quoted 16 lines · Matthias Klose
Quoted 15 lines · Ian Campbell
Quoted 2 lines · Matthias Klose
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.
Quoted 8 lines
-
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.
Quoted 8 lines
Quoted 1 line
Why is the first one potentially unsafe?
because I didn't check where it's used.
Quoted 2 lines
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.
Quoted 4 lines
Quoted 2 lines
Please could you provide a Signed-off-by line for upstream?
hmm, any pointers? I hope my friendly distribution packager could help ...
Quoted 8 lines
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<[email protected]>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
Description: Replace python string exceptions with ValueError exceptions
Author: Matthias Klose <[email protected]>
Bug-Debian: http://bugs.debian.org/585372
tools/python/xen/util/bugtool.py +1 -1
@@ -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):
tools/python/xen/xend/XendBase.py +1 -1
@@ -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())
tools/python/xen/xm/xenapi_create.py +1 -1
@@ -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
tools/python/xen/xm/main.py +1 -1
@@ -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 = {
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Matthias Klose writes ("[Xen-devel] Re: [Pkg-xen-devel] using xen tools with python2.6"):
Quoted 4 lines · Ian Campbell
Quoted 1 line
Why is the first one potentially unsafe?
because I didn't check where it's used.
I think, to be honest, that the exception and error handling in the Xen python code is bad enough already that this patch is very unlikely to make things worse. Particularly since you've diligently checked all the occurrences in xend and xm itself.
So I have applied your patch.
Thanks,
Ian.
Quoted 4 lines · Ian Jackson
Matthias Klose writes ("[Xen-devel] Re: [Pkg-xen-devel] using xen tools with python2.6"):
Quoted 3 lines · Ian Campbell
Quoted 1 line
Why is the first one potentially unsafe?
Quoted 8 lines
Quoted 1 line
because I didn't check where it's used.
I think, to be honest, that the exception and error handling in the Xen python code is bad enough already that this patch is very unlikely to make things worse. Particularly since you've diligently checked all the occurrences in xend and xm itself.
So I have applied your patch.
Ack, I agree.
Thanks Matthias.
Ian.