diff options
| author | Jakub Darmach <jakub@stackhpc.com> | 2022-01-27 14:39:54 +0100 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2022-01-28 09:52:16 +0000 |
| commit | 1fe983df4fafa5a4a8eafe206e4abfaec2418da1 (patch) | |
| tree | 09ef1d9920bebb346cc53aac5d96b4fd9ed2e0ca /docker/base/set_configs.py | |
| parent | d7dde0265383e2498cfec9420b1a35d1f754b47f (diff) | |
| download | kolla-1fe983df4fafa5a4a8eafe206e4abfaec2418da1.tar.gz kolla-1fe983df4fafa5a4a8eafe206e4abfaec2418da1.zip | |
Ensure set_configs sets execute bit on directories
While handling permissions for directories, set_configs.py configures them
same as for files - i.e. 0640 set in config.json which works fine for file
will cause any potential subdirectories to lack traverse permission.
Check and permission change was added to handle_permissions function
to add +x if +r is present for user, group, others.
Change-Id: Ic6e3ae4ff40c6ce5a5c0646ed309a2938903f6c0
Diffstat (limited to 'docker/base/set_configs.py')
| -rw-r--r-- | docker/base/set_configs.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 0cb0e414c..e624f29ba 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -20,6 +20,7 @@ import logging import os import pwd import shutil +import stat import sys @@ -369,6 +370,15 @@ def handle_permissions(config): perm = ''.join([perm[:1], 'o', perm[1:]]) perm = int(perm, base=0) + # Ensure execute bit on directory if read bit is set + if os.path.isdir(path): + if perm & stat.S_IRUSR: + perm |= stat.S_IXUSR + if perm & stat.S_IRGRP: + perm |= stat.S_IXGRP + if perm & stat.S_IROTH: + perm |= stat.S_IXOTH + try: os.chmod(path, perm) except OSError: |
