Jeffrey Smith created AMBARI-26628:
--------------------------------------

             Summary: Additional inconsistencies in sudo.py
                 Key: AMBARI-26628
                 URL: https://issues.apache.org/jira/browse/AMBARI-26628
             Project: Ambari
          Issue Type: Bug
    Affects Versions: trunk
            Reporter: Jeffrey Smith


After completing AMBARI-26622, I came across several other places in sudo.py 
where there are inconsistencies between the root and non-root functions, as 
well as some places that may not work correctly.

Examples:
root vs non-root
{code:java}
def chmod_recursive(path, recursive_mode_flags, 
recursion_follow_links=False){code}

and
{code:java}
def chmod_recursive(path, recursive_mode_flags, recursion_follow_links):{code}


The non-root version of chmod_recursive looks like it's missing the `sudo=True` 
option as well (sudo=True is present in chown_recursive).

The root version of chmod_recursive also appears to be incorrectly checking for 
flags:
{code:java}

    dir_attrib = recursive_mode_flags["d"] if "d" in recursive_mode_flags else 
None
    files_attrib = recursive_mode_flags["f"] if "d" in recursive_mode_flags 
else None{code}

dir_attrib makes sense, but files_attrib is also checking for "d" in 
recursive_mode_flags, which would give unexpected results if "f" were passed 
without "d" being passed as well.

Per the docstrings in 
[https://github.com/apache/ambari/blob/trunk/ambari-common/src/main/python/resource_management/core/resources/system.py#L129,]
 sudo.py does not behave as it should.

I will add any additional inconsistencies I find to this ticket.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to