I have a volume attached in kubernetes with path /var/www/aaa/tmp
.
That volume was created using path.mkdir() and currently have 755
permissions.
It was created with code path.mkdir(parents=True, exist_ok=True)
initially.
I'm trying to update its permissions without deleting the existing path.
I'm using path.mkdir(parents=True, exist_ok=True, mode=0o777)
. I'm still facing issues related to permissions and getting 502 Bad gateway
for the flask app that is creating the above directories.
Does the path.mkdir(parents=True, exist_ok=True, mode=0o777)
updates the path permissions if it already exists and have 755
permissions? Or will it ignore it completely as we've mentioned exists_ok=True
? I don't see the permissions getting updated for the path.
Should I be deleting the path completely and re-running the path.mkdir.....
with mode=0o777
which creates new directories and set permissions?
Edit 1:
I've tried using os.chmod()
on the path. But it's throwing PermissionError
.
Here's the code snippet.
path.mkdir(parents=True, exist_ok=True)
os.chmod(path, mode=0o777)
Error:
File "./app/init.py", line 79, in create_prediction_app create_directories(app) File "./app/init.py", line 36, in create_directories os.chmod(path, mode=0o777) PermissionError: [Errno 1] Operation not permitted: '/var/www/aaa/tmp' unable to load app 0 (mountpoint='') (callable not found or import error) * no app loaded. GAME OVER *