You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by pengjianhua <pe...@zte.com.cn> on 2017/09/07 13:45:47 UTC

Review Request 62156: The update_property.py should exit the loop to improve execution efficiency once the attribute value is set.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62156/
-----------------------------------------------------------

Review request for ranger, Alok Lal, Ankita Sinha, Don Bosco Durai, Colm O hEigeartaigh, Gautam Borad, Madhan Neethiraj, Ramesh Mani, Selvamohan Neethiraj, Velmurugan Periasamy, and Qiang Zhang.


Bugs: RANGER-1769
    https://issues.apache.org/jira/browse/RANGER-1769


Repository: ranger


Description
-------

Even if the attribute value is first matched, the following code segment will still traverse all the attributes.
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)

The program should exit the loop to improve execution efficiency once the attribute value is set.


Diffs
-----

  security-admin/scripts/update_property.py 80ccdb8f 


Diff: https://reviews.apache.org/r/62156/diff/1/


Testing
-------


Thanks,

pengjianhua


Re: Review Request 62156: The update_property.py should exit the loop to improve execution efficiency once the attribute value is set.

Posted by Qiang Zhang <zh...@zte.com.cn>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62156/#review184921
-----------------------------------------------------------


Ship it!




Ship It!

- Qiang Zhang


On 九月 7, 2017, 1:45 p.m., pengjianhua wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62156/
> -----------------------------------------------------------
> 
> (Updated 九月 7, 2017, 1:45 p.m.)
> 
> 
> Review request for ranger, Alok Lal, Ankita Sinha, Don Bosco Durai, Colm O hEigeartaigh, Gautam Borad, Madhan Neethiraj, Ramesh Mani, Selvamohan Neethiraj, Velmurugan Periasamy, and Qiang Zhang.
> 
> 
> Bugs: RANGER-1769
>     https://issues.apache.org/jira/browse/RANGER-1769
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> Even if the attribute value is first matched, the following code segment will still traverse all the attributes.
> 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)
> 
> The program should exit the loop to improve execution efficiency once the attribute value is set.
> 
> 
> Diffs
> -----
> 
>   security-admin/scripts/update_property.py 80ccdb8f 
> 
> 
> Diff: https://reviews.apache.org/r/62156/diff/1/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> pengjianhua
> 
>