[sysadmin-bin] create-auth: correct usage of user_list and user_data



commit 853e1fa273adc364aa078afd852117350b4ffefb
Author: Olav Vitters <olav vitters nl>
Date:   Sat Apr 2 14:31:42 2011 +0200

    create-auth: correct usage of user_list and user_data

 create-auth |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/create-auth b/create-auth
index 1401efe..0121fdb 100755
--- a/create-auth
+++ b/create-auth
@@ -206,7 +206,7 @@ def remove_directory (dir):
             remove_directory (path)
     os.rmdir (dir)
 
-def create_directory_structure (user_list):
+def create_directory_structure (user_data):
     base_directory_name = tempfile.mktemp ('-sshd')
     sshd_directory_name = base_directory_name + "/sshd"
     users_directory_name = sshd_directory_name + "/users"
@@ -217,7 +217,7 @@ def create_directory_structure (user_list):
         os.mkdir (users_directory_name, 0711)
 
         # make a users dir
-        for user in user_list:
+        for uid, user in user_data.iteritems():
             user_dir_name = users_directory_name + "/" + user['uid']
             authorized_keys_file = user_dir_name + "/authorized_keys"
             os.mkdir (user_dir_name, 0700)
@@ -312,17 +312,17 @@ if __name__ == '__main__':
         print_user_list('Created home directory for', created_users)
         sys.exit(1)
 
-    user_list = build_user_hash (group_list, restrict=options.restrict)
-    if not len(user_list):
+    user_data = build_user_hash (group_list, restrict=options.restrict)
+    if not len(user_data):
         print "ERROR: No users to create! Likely empty LDAP directory!!"
         sys.exit(1)
 
     if options.homedirs == 'basic':
-        created_users = create_home_directories(user_list)
+        created_users = create_home_directories(user_data)
         print_user_list('Created home directory for', created_users)
         sys.exit(1)
 
-    base_directory_name = create_directory_structure (user_list)
+    base_directory_name = create_directory_structure(user_data)
 
     initial_user_hash = get_md5sum_hash ()
     status = subprocess.call(['rsync', '-aq', '--delete', '%s/sshd/' % base_directory_name, '/etc/sshd/'])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]