mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +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):
|
def subcommand_get_group_users(arguments):
|
||||||
""" Get the list of users of an LDAP group."""
|
"""Get the list of users of an LDAP group."""
|
||||||
process = _run(['ldapgid', '-P', arguments.groupname],
|
try:
|
||||||
stdout=subprocess.PIPE)
|
process = _run(['ldapgid', '-P', arguments.groupname],
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return # Group does not exist, return empty list
|
||||||
|
|
||||||
output = process.stdout.decode()
|
output = process.stdout.decode()
|
||||||
users = output.rsplit(':')[-1]
|
users = output.rsplit(':')[-1]
|
||||||
if users:
|
if users:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user