fedora-accounts export-shell-accounts.py,1.4,1.5

Michael Patrick McGrath (mmcgrath) fedora-extras-commits at redhat.com
Wed Dec 5 15:28:30 UTC 2007


Author: mmcgrath

Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8562

Modified Files:
	export-shell-accounts.py 
Log Message:
made the counters global as to remove duplicates in group which causes errors


Index: export-shell-accounts.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/export-shell-accounts.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- export-shell-accounts.py	5 Dec 2007 03:07:00 -0000	1.4
+++ export-shell-accounts.py	5 Dec 2007 15:28:27 -0000	1.5
@@ -1,4 +1,4 @@
-#!/usr/bin/python -tt
+#!/usr/bin/python
 
 ### Note: do not change the /home/fedora/* home directory pattern here
 ### without also updating the process-shell-accounts script.
@@ -21,12 +21,15 @@
 fh_passwd = open(outdir + '/passwd', 'w')
 fh_shadow = open(outdir + '/shadow', 'w')
 fh_group = open(outdir + '/group', 'w')
-
-def write_logins(dbres, type, ctr, gctr, admins):
+ctr=0
+gctr=0
+def write_logins(dbres, type, admins):
     global outdir
     global fh_passwd
     global fh_shadow
     global fh_group
+    global ctr
+    global gctr
 
     for res in dbres:
         uid, username, email, password, gecos, ssh_key = res
@@ -59,7 +62,6 @@
 
         basic_group_line = "%s:x:%s:" % (username, uid)
         basic_shadow_line = "%s:%s:99999:0:99999:7:::" % (username, encodedPass)
-
         fh_passwd.write("=%s %s\n" % (uid, basic_line))
         fh_passwd.write("0%d %s\n" % (ctr, basic_line))
         fh_passwd.write(".%s %s\n" % (username, basic_line))
@@ -109,13 +111,13 @@
     dbres2 = dbc2.fetchall()
 
 
-ctr = 0
-gctr = 0
+#ctr = 0
+#gctr = 0
 if dbres2:
-    write_logins(dbres2, 'scm', ctr, gctr, admins)
+    write_logins(dbres2, 'scm', admins)
 
 if dbres:
-    write_logins(dbres, 'admin', ctr, gctr, admins)
+    write_logins(dbres, 'admin', admins)
 
 
 qry = """




More information about the fedora-extras-commits mailing list