Function ensure_tree in fileutils.py have permission problems
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.utils |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Follow is the master branch code:
def ensure_tree(path, mode=_DEFAULT_
"""Create a directory (and any ancestor directories required)
:param path: Directory to create
:param mode: Directory creation permissions
"""
try:
except OSError as exc:
if exc.errno == errno.EEXIST:
if not os.path.
else:
raise
This code: os.makedirs(path, mode), CAN'T set the dir permision right.
when openstack ironic project make dirs for tftp, It wants to make the new dir 0777, but it only 755 permissions or 750 permissions.
Same problem:
http://
I think we should change the code to:
def ensure_tree(path, mode=_DEFAULT_
"""Create a directory (and any ancestor directories required)
:param path: Directory to create
:param mode: Directory creation permissions
"""
try:
except OSError as exc:
if exc.errno == errno.EEXIST:
if not os.path.
else:
raise
thanks for reporting this issue .Not sure os.umask will affect the python process only or the operating system. If the whole operating system. it seems not a good solution.
Maybe we need another function to handle the case without affecting other consumers