display_error_and_exit function incorrectly guesses XML format

Bug #513062 reported by Garrett Holmstrom
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
euca2ools
Triaged
Low
Mitch Garnaat

Bug Description

euca2ools's display_error_and_exit function determines whether or not an exception's message is XML by looking for a "<" character. When I ran euca-describe-images its call to get_all_images threw a SAXParseException (the cause of which was probably my fault and irrelevant to this bug.) The stringified version of the exception passed this check but wasn't XML, making display_error_and_exit's call to minidom.parseString throw an uncaught exception and making the program print a backtrace instead of an error message.

In my case, the variable ex near the very bottom of euca-describe-images yielded the following strings that illustrate the problem:

``repr(ex)'' yields ``SAXParseException('no element found',)''
``'%s' % ex'' yields ``<unknown>:1:0: no element found''

I propose changing the check for XML-ness on __init__.py lines 1071 and 1072 to something that checks the beginning and end of error messages so we are more likely to get useful output instead of backtraces when things go wrong. Perhaps even something along the lines of ``if ex.__str__().strip().startswith('<') && ex.__str__().strip().endswith('>')'' would be more robust than just assuming that anything with a '<' character is always XML.

Revision history for this message
Garrett Holmstrom (gholms) wrote :
Changed in eucalyptus:
assignee: nobody → Mitch Garnaat (mitch-garnaat)
Revision history for this message
graziano obertelli (graziano.obertelli) wrote :

This is a euca2ools issue.

affects: eucalyptus → euca2ools
Changed in euca2ools:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Andy Grimm (agrimm) wrote :

This issue is now being tracked upstream at http://eucalyptus.atlassian.net/browse/TOOLS-97

Please watch that issue for further updates.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.