wsgi.XMLDeserializer tries to access non existing attributes of xml node

Bug #1119262 reported by Tatyanka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Tatyanka

Bug Description

extract_text method of wsgi.XMLDeserializer tries to access "childNodes" attribute of "node" object which is supposed to be of type xml.etree.ElementTree.Element which in turn doesn't have such attribute. (https://github.com/openstack/quantum/blob/master/quantum/wsgi.py#L567)

The error seems to be caused by refactoring in this change (https://review.openstack.org/#/c/19998/) which replaced library for parsing xml from minidom to etree but left some calls to minidom unchanged.

Here is the trace, obtained by calling extract_text:

Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/unittest2/case.py", line 340, in run
    testMethod()
  File "/home/repos/quantum/quantum/tests/unit/test_wsgi.py", line 658, in test_extract_text
    deserializer.extract_text(doc), 'test_child')
  File "/home/repos/quantum/quantum/wsgi.py", line 567, in extract_text
    if len(node.childNodes) == 1:
AttributeError: 'Element' object has no attribute 'childNodes'

Revision history for this message
Ante Karamatić (ivoks) wrote :

Hm... test_extract_text() doesn't exist anywhere in quantum source. In fact, quantum/tests/unit/test_wsgi.py has only 373 lines. Am I missing something?

Revision history for this message
Tatyanka (tatyana-leontovich) wrote :

Actually you are write, at this moment I've try to add it (in scope of https://review.openstack.org/#/c/20692/), but can't accordingly to this issue. I can provide to you the test, if it will be helpful

Changed in quantum:
assignee: nobody → Tatyana (tatyana-leontovich)
tags: added: api low-hanging-fruit
Changed in quantum:
importance: Undecided → Medium
Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

Tatyana - what's the outcome of your triaging?
From my perspective it seems extract_test is an unused method and should therefore be removed.
Indeed there's now similar logic in wsgy.py, lines 523-535.

If that is confirmed, I suggest lowering the priority of this bug, and fixing it by simply removing the method.

Revision history for this message
Tatyanka (tatyana-leontovich) wrote :

Salvatore,
I absolutely agree with you. There is as minimum four unused method in wsgi module, that ate broken. An as you've written, may be, we can remove it. My point is that there should not be broken code in this module. Unfortunaly I can not confirm, can we remove these methods or not. And against, agree with you, that we need receive such confirmation.

Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

From my perspective, you have my +2 if you want to remove this method and any other bit of unused code you found in the wsgi module.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

Fix proposed to branch: master
Review: https://review.openstack.org/21631

Changed in quantum:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/21631
Committed: http://github.com/openstack/quantum/commit/6f2b1899610d58c401a64776f936fbd300b662bd
Submitter: Jenkins
Branch: master

commit 6f2b1899610d58c401a64776f936fbd300b662bd
Author: Tatyana Leontovich <email address hidden>
Date: Mon Feb 11 12:17:12 2013 +0200

    Unused methods in quantum.wsgi clean up

    Remove broken unused methods:
    * wsgi.XMLDeserializer.extract_text,
    * wsgi.XMLDeserializer.find_first_child_named,
    * wsgi.XMLDeserializer.find_first_child_named,
    * wsgi.XMLDictSerializer._create_link_nodes.

    Change-Id: If00af68683571285adb0516d8fc36790bd83ffa5
    Fixes: bug #1119262

Changed in quantum:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in quantum:
milestone: none → grizzly-3
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: grizzly-3 → 2013.1
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.