My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 8: Plugin xml needs to be parsed as seperate document
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  Moeh...@gmail.com
Closed:  Jun 2008


 
Project Member Reported by Moeh...@gmail.com, Feb 27, 2008
A bug in amara xml_xpath causes the xpathquery to return a completely 
different node, which is not in the document specified in the parameters.

Example xml as variable 'test':
<config>
 <!-- check 1 -->
 <check type="ping" active="true">
    <location>
      <host>code.google.com</host>
      <port>80</port>
    </location>
 </check>
 <!-- check 2 -->
 <check type="ftp" active="true">
     <location>
       <host>google.com</host>
       <port>21</port>
     </location>
 </check>
</config

Now, we will parse the check 1 as a node to a function. When using the 
xml_xpath function on the first node (check 1), the result will be not 
expected.
for check in checks:
  dosomething(check) # parse checks, first check 1

def dosomething(xml)
  print xml #returns <check>....</check> with content of check 1

host = test.xml_xpath("//location/host/text()[1]")[0].data
# host will return google.com and NOT code.google.com


Workaround:
Parse the xml using amara before passing to the function.

for check in checks:
  dosomething(amara.parse(check.xml())) # this does work

The input xml for the function dosomething() is the same, but the result 
is now what is should be.

Bug can be found in revision 61 (trunk/src/kinti/runner/server.py that 
calls the plugin trunk/src/plugins/ping.py)
Fixed in revision 62
Feb 27, 2008
Project Member #1 Moeh...@gmail.com
low priority
Labels: -Priority-Medium Priority-Low
Mar 19, 2008
Project Member #2 Moeh...@gmail.com
This is a feature, not a bug. We should parse it again though, to avoid plugins 
being able to edit/read eachothers configuration.
Summary: Plugin xml needs to be parsed as seperate document
Labels: -Priority-Low Priority-high
Jun 4, 2008
Project Member #3 Moeh...@gmail.com
implemented
Status: Fixed

Powered by Google Project Hosting