[ https://issues.apache.org/jira/browse/AMBARI-22632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Akira Ajisaka reassigned AMBARI-22632: -------------------------------------- Assignee: Akira Ajisaka > Fix misuses of os.path.dirname(path) > ------------------------------------ > > Key: AMBARI-22632 > URL: https://issues.apache.org/jira/browse/AMBARI-22632 > Project: Ambari > Issue Type: Bug > Reporter: Akira Ajisaka > Assignee: Akira Ajisaka > > There are some misuses of os.path.dirname(path) in Ambari code base. For > example, the following code wrongly sets the permission of {{/ats/done}} to > 0755 when {{params.entity_groupfs_store_dir}} is {{/ats/done/}} (with > trailing /). > {code:title=yarn.py} > parent_path = os.path.dirname(params.entity_groupfs_store_dir) > params.HdfsResource(parent_path, > type="directory", > change_permissions_for_parents=True, > owner=params.yarn_user, > group=params.user_group, > mode=0755 > ) > {code} > This is because os.path.dirname(path) does not return the parent directory if > the path ends with '/'. > {code} > $ python > >>> import os > >>> os.path.dirname('/ats/done/') > '/ats/done' > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)