You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Akira Ajisaka (JIRA)" <ji...@apache.org> on 2017/12/12 16:34:00 UTC
[jira] [Commented] (AMBARI-22632) Fix misuses of
os.path.dirname(path)
[ https://issues.apache.org/jira/browse/AMBARI-22632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16287839#comment-16287839 ]
Akira Ajisaka commented on AMBARI-22632:
----------------------------------------
Created a subtask to fix this in yarn.py. There are many misuses and I don't think all of them can be fixed in a single patch.
> 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
>
> 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)