mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
users: Don't fail badly when admin group does not exist
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
e1e654554e
commit
caa266e348
@ -355,9 +355,13 @@ def subcommand_remove_user_from_group(arguments):
|
||||
|
||||
|
||||
def subcommand_get_group_users(arguments):
|
||||
""" Get the list of users of an LDAP group."""
|
||||
process = _run(['ldapgid', '-P', arguments.groupname],
|
||||
stdout=subprocess.PIPE)
|
||||
"""Get the list of users of an LDAP group."""
|
||||
try:
|
||||
process = _run(['ldapgid', '-P', arguments.groupname],
|
||||
stdout=subprocess.PIPE)
|
||||
except subprocess.CalledProcessError:
|
||||
return # Group does not exist, return empty list
|
||||
|
||||
output = process.stdout.decode()
|
||||
users = output.rsplit(':')[-1]
|
||||
if users:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user