Catch exception during calling os.chmod in set_configs.py
set_perms may fail in some case, but it is not critical. Just leave a warning rather than exit. Change-Id: I757c7b60611fb6c0547bd1b26ec8a8af03684e5f Closes-Bug: 1689454
This commit is contained in:
parent
5841abe910
commit
97467c38c4
@ -354,7 +354,13 @@ def handle_permissions(config):
|
|||||||
|
|
||||||
def set_perms(path, uid, gid):
|
def set_perms(path, uid, gid):
|
||||||
LOG.info('Setting permission for %s', path)
|
LOG.info('Setting permission for %s', path)
|
||||||
|
if not os.path.exists(path):
|
||||||
|
LOG.warning('file %s do not exist', path)
|
||||||
|
return
|
||||||
|
try:
|
||||||
os.chown(path, uid, gid)
|
os.chown(path, uid, gid)
|
||||||
|
except OSError:
|
||||||
|
LOG.exception('Set file permission failed for %s', path)
|
||||||
|
|
||||||
for dest in glob.glob(path):
|
for dest in glob.glob(path):
|
||||||
set_perms(dest, uid, gid)
|
set_perms(dest, uid, gid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user