From caa266e34832fbc72bdab3335e38f6552511f523 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 19 Aug 2019 19:38:30 -0700 Subject: [PATCH] users: Don't fail badly when admin group does not exist Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- actions/users | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/actions/users b/actions/users index f856f5d36..12555e52c 100755 --- a/actions/users +++ b/actions/users @@ -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: