mirror of
https://github.com/moepman/acertmgr.git
synced 2024-11-14 06:55:29 +01:00
Check result of file metadata changes
Changing ownership and permissions is not supported on all filesystems. This patch prints a warning whenever it fails to set these properties, but continues without a fatal error.
This commit is contained in:
parent
e8c82197a9
commit
b396f0bb07
10
acertmgr.py
10
acertmgr.py
@ -191,8 +191,14 @@ def cert_put(domain, settings):
|
||||
# set owner and permissions
|
||||
uid = pwd.getpwnam(crt_user).pw_uid
|
||||
gid = grp.getgrnam(crt_group).gr_gid
|
||||
os.chown(crt_path, uid, gid)
|
||||
os.chmod(crt_path, int(crt_perm, 8))
|
||||
try:
|
||||
os.chown(crt_path, uid, gid)
|
||||
except OSError:
|
||||
print('Warning: Could not set certificate file ownership!')
|
||||
try:
|
||||
os.chmod(crt_path, int(crt_perm, 8))
|
||||
except OSError:
|
||||
print('Warning: Could not set certificate file permissions!')
|
||||
|
||||
# restart/reload service
|
||||
subprocess.call(crt_notify.split())
|
||||
|
Loading…
Reference in New Issue
Block a user