[sysadmin-bin] Don't fail when a specific group of users we want to create a homedir for has no members
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Don't fail when a specific group of users we want to create a homedir for has no members
- Date: Thu, 15 Jan 2015 16:34:45 +0000 (UTC)
commit 47378a75d7573e9a5fa995d390f1a9a263ba7f7c
Author: Andrea Veri <av gnome org>
Date: Thu Jan 15 17:34:37 2015 +0100
Don't fail when a specific group of users we want to create a homedir for has no members
create-homedirs | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/create-homedirs b/create-homedirs
index ac9987a..77f5172 100755
--- a/create-homedirs
+++ b/create-homedirs
@@ -27,12 +27,15 @@ def get_uids_from_group(group):
else:
group_info = group_data[0][1]
members = set()
- for userid in group_info['member']:
- splitentry = userid.split(',')
- singleentry = splitentry[0]
- splitteduid = singleentry.split('=')
- uid = splitteduid[1]
- members.add(uid)
+ try:
+ for userid in group_info['member']:
+ splitentry = userid.split(',')
+ singleentry = splitentry[0]
+ splitteduid = singleentry.split('=')
+ uid = splitteduid[1]
+ members.add(uid)
+ except KeyError:
+ pass
return members
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]