fedora-accounts export-shell-accounts.py,1.5,1.6
Michael Patrick McGrath (mmcgrath)
fedora-extras-commits at redhat.com
Wed Dec 5 15:44:39 UTC 2007
Author: mmcgrath
Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10170
Modified Files:
export-shell-accounts.py
Log Message:
got fedorapeople working again
Index: export-shell-accounts.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/export-shell-accounts.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- export-shell-accounts.py 5 Dec 2007 15:28:27 -0000 1.5
+++ export-shell-accounts.py 5 Dec 2007 15:44:37 -0000 1.6
@@ -10,7 +10,7 @@
VALIDSCMS = ['svn', 'hg', 'cvs', 'git', 'bzr']
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...
"""
@@ -79,6 +79,30 @@
dbc = dbh.cursor()
dbc2 = 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)
+
+
groups = []
scms = []
for group in our_groups:
@@ -94,9 +118,9 @@
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, (groups, ))
+ dbc.execute(qry, (groups, good_users))
dbres = dbc.fetchall()
for admin in dbres:
admins.append(admin[1])
More information about the fedora-extras-commits
mailing list