mirror of
https://github.com/moepman/acertmgr.git
synced 2024-11-13 06:45:24 +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