fedora-accounts export-shell-accounts.py, 1.2, 1.3 export-shell-accounts.sh, 1.13, 1.14

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Mon Jul 9 19:25:21 UTC 2007


Author: skvidal

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

Modified Files:
	export-shell-accounts.py export-shell-accounts.sh 
Log Message:

make account exports output the fedorapeople list of folks



Index: export-shell-accounts.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/export-shell-accounts.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- export-shell-accounts.py	15 Nov 2005 22:17:11 -0000	1.2
+++ export-shell-accounts.py	9 Jul 2007 19:25:18 -0000	1.3
@@ -8,14 +8,17 @@
 import getopt, re
 
 opts, args = getopt.getopt(sys.argv[1:], '', ('usage', 'help'))
-if len(args) < 2 or ('--usage','') in opts or ('--help','') in opts:
+if len(args) < 1 or ('--usage','') in opts or ('--help','') in opts:
 	print """
-Usage: export-accounts.py OUTDIR GROUPS...
+Usage: export-accounts.py OUTDIR [GROUPS]
 """
 	sys.exit(1)
+
 outdir = args[0]
 our_groups = args[1:]
-
+if len(args) < 2:
+    our_groups = []
+    
 fh_passwd = open(outdir + '/passwd', 'w')
 fh_shadow = open(outdir + '/shadow', 'w')
 fh_group = open(outdir + '/group', 'w')
@@ -23,13 +26,37 @@
 dbh = website.get_dbh(dbctx='live')
 dbc = dbh.cursor()
 
+if not our_groups:
+    # first get all the groups which do NOT begin with cla_* then put that as the list as acceptable groups
+    qry = """select name from project_group where name NOT LIKE 'cla%'"""
+    
+    dbc.execute(qry)
+    dbc.execute(qry)
+    for groups in dbc.fetchall():
+        for grp in groups:
+            our_groups.append(grp)
+            
+
+# now get the list of userids in the cla_done group to pass to this next query to get the list of users we care about
+# find cla_done id
+qry = """select id from project_group where name = 'cla_done'"""
+dbc.execute(qry)
+cla_id = dbc.fetchone()[0]
+
+good_users = []
+qry = """select person_id from role where role_status = 'approved' and project_group_id = %s"""
+dbc.execute(qry, (cla_id, ))
+for userlists in dbc.fetchall():
+    good_users.extend(userlists)
+    
+
 qry = """
 SELECT DISTINCT person.id, person.username, person.email, person.password, person.human_name, person.ssh_key
 FROM role, person, project_group WHERE person.id = role.person_id AND project_group.id = role.project_group_id
-AND person.approval_status = 'approved' AND role.role_status = 'approved' AND project_group.name IN %s
+AND person.approval_status = 'approved' AND role.role_status = 'approved' AND project_group.name IN %s AND person.id in %s
 """
 
-dbc.execute(qry, (our_groups, ))
+dbc.execute(qry, (our_groups, good_users))
 
 
 ctr = 0


Index: export-shell-accounts.sh
===================================================================
RCS file: /cvs/fedora/fedora-accounts/export-shell-accounts.sh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- export-shell-accounts.sh	9 Jul 2007 15:24:52 -0000	1.13
+++ export-shell-accounts.sh	9 Jul 2007 19:25:18 -0000	1.14
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-for I in buildsign build cvs main web fpserv torrent all bastion security test; do
+for I in buildsign build cvs main web fpserv torrent all bastion security people test; do
 	mkdir -p /srv/web/accounts/shell-accounts-$I
 done
 ESA=/srv/web/accounts/export-shell-accounts.py
@@ -15,8 +15,9 @@
 $ESA /srv/web/accounts/shell-accounts-torrent sysadmin-web sysadmin-main torrentadmin
 $ESA /srv/web/accounts/shell-accounts-security sysadmin-main sysadmin-securit
 $ESA /srv/web/accounts/shell-accounts-test sysadmin-main sysadmin-test
+$ESA /srv/web/accounts/shell-accounts-people 
 
-for I in buildsign build cvs main web fpserv torrent all bastion security test; do
+for I in buildsign build cvs main web fpserv torrent all bastion security people test; do
 	pushd /srv/web/accounts/shell-accounts-$I &> /dev/null || exit 1
 		tar -czf /srv/web/accounts/shell-accounts-$I.tar.gz.new .
 	popd &> /dev/null




More information about the fedora-extras-commits mailing list