Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-22632

Fix misuses of os.path.dirname(path)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      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 /).

      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
                                )
      

      This is because os.path.dirname(path) does not return the parent directory if the path ends with '/'.

      $ python
      >>> import os
      >>> os.path.dirname('/ats/done/')
      '/ats/done'
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            aajisaka Akira Ajisaka
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h