mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add user and group wrappers
New classes for user and group names provide a convenient way to access the uid and primary gid of a user / gid of a group. The classes also provide chown() and chgrp() methods to simplify common operations. The wrappers are subclasses of builtin str type and behave like ordinary strings with additional features. The pwd and grp structs are retrieved once and then cached. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
committed by
Rob Crittenden
parent
99a40cbbe9
commit
72fb4e60c8
@@ -11,7 +11,6 @@ import re
|
||||
import os
|
||||
import glob
|
||||
import shutil
|
||||
import pwd
|
||||
import fileinput
|
||||
import ssl
|
||||
import stat
|
||||
@@ -755,8 +754,7 @@ def copy_crl_file(old_path, new_path=None):
|
||||
os.symlink(realpath, new_path)
|
||||
else:
|
||||
shutil.copy2(old_path, new_path)
|
||||
pent = pwd.getpwnam(constants.PKI_USER)
|
||||
os.chown(new_path, pent.pw_uid, pent.pw_gid)
|
||||
constants.PKI_USER.chown(new_path)
|
||||
|
||||
tasks.restore_context(new_path)
|
||||
|
||||
@@ -1104,8 +1102,7 @@ def update_http_keytab(http):
|
||||
'Cannot remove file %s (%s). Please remove the file manually.',
|
||||
paths.OLD_IPA_KEYTAB, e
|
||||
)
|
||||
pent = pwd.getpwnam(http.keytab_user)
|
||||
os.chown(http.keytab, pent.pw_uid, pent.pw_gid)
|
||||
http.keytab_user.chown(http.keytab)
|
||||
|
||||
|
||||
def ds_enable_sidgen_extdom_plugins(ds):
|
||||
|
||||
Reference in New Issue
Block a user