[ 
https://issues.apache.org/jira/browse/RANGER-1769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

peng.jianhua updated RANGER-1769:
---------------------------------
    Description: 
Even if the attribute value is first matched, the following code segment will 
still traverse all the attributes.
{code:title=update_property.py|borderStyle=solid}
root = xml.getroot()
for child in root.findall('property'):
    name = child.find("name").text.strip()
    if name == property_name:
        child.find("value").text = property_value
xml.write(xml_path)
{code}
The program should exit the loop to improve execution efficiency once the 
attribute value is set.

  was:
Even if the attribute value is first matched, the following code segment will 
still traverse all the attributes.
{code:title=update_property.py|borderStyle=solid}
root = xml.getroot()
for child in root.findall('property'):
    name = child.find("name").text.strip()
    if name == property_name:
        child.find("value").text = property_value
xml.write(xml_path)
{code}
The program should exit the loop to improve execution efficiency once the 
attribute value is changed.


> The update_property.py should exit the loop to improve execution efficiency 
> once the attribute value is set.
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: RANGER-1769
>                 URL: https://issues.apache.org/jira/browse/RANGER-1769
>             Project: Ranger
>          Issue Type: Bug
>          Components: admin
>    Affects Versions: 1.0.0, master
>            Reporter: peng.jianhua
>            Assignee: peng.jianhua
>            Priority: Minor
>              Labels: patch
>
> Even if the attribute value is first matched, the following code segment will 
> still traverse all the attributes.
> {code:title=update_property.py|borderStyle=solid}
> root = xml.getroot()
> for child in root.findall('property'):
>     name = child.find("name").text.strip()
>     if name == property_name:
>         child.find("value").text = property_value
> xml.write(xml_path)
> {code}
> The program should exit the loop to improve execution efficiency once the 
> attribute value is set.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to