mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] directly call python instead of using os.system
This commit is contained in:
parent
32002d56a0
commit
d14bc31771
1 changed files with 6 additions and 4 deletions
|
@ -129,11 +129,13 @@ def user_create(auth, username, firstname, lastname, mail, password,
|
||||||
domain=mail.split("@")[1]))
|
domain=mail.split("@")[1]))
|
||||||
|
|
||||||
# Get random UID/GID
|
# Get random UID/GID
|
||||||
uid_check = gid_check = 0
|
all_uid = {x.pw_uid for x in pwd.getpwall()}
|
||||||
while uid_check == 0 and gid_check == 0:
|
all_gid = {x.pw_gid for x in pwd.getpwall()}
|
||||||
|
|
||||||
|
uid_guid_found = False
|
||||||
|
while not uid_guid_found:
|
||||||
uid = str(random.randint(200, 99999))
|
uid = str(random.randint(200, 99999))
|
||||||
uid_check = os.system("getent passwd %s" % uid)
|
uid_guid_found = uid not in all_uid and uid not in all_gid
|
||||||
gid_check = os.system("getent group %s" % uid)
|
|
||||||
|
|
||||||
# Adapt values for LDAP
|
# Adapt values for LDAP
|
||||||
fullname = '%s %s' % (firstname, lastname)
|
fullname = '%s %s' % (firstname, lastname)
|
||||||
|
|
Loading…
Add table
Reference in a new issue