#!/usr/bin/python -tt # # Script to pull all of a group's approved member information # from the Fedora Account System, in a format to be used with # git-cvsimport(1). # # (C) 2008 Paul W. Frields. This script is licensed under the # GNU General Public License, version 2 or any later version. # # This script requires the python-fedora RPM >= 0.3.4 # # ChangeLog: # * 0.1 Paul W. Frields # - Initial version # * 0.2 Paul W. Frields # - Use new people_by_groupname method import os, sys import codecs sys.stdout = codecs.getwriter('utf8')(sys.stdout) from fedora.client.fas2 import * from fedora.client import AppError from getpass import getpass username = raw_input('Enter username: ') password = getpass('Enter password: ') try: fas = AccountSystem(username=username, password=password) except: sys.exit(-1) groupname = raw_input('Enter account system group name: ') try: people = fas.people_by_groupname(groupname) except (KeyError, AppError): sys.exit(-2) # We only care about approved people. for person in people: print '%s=%s <%s>' % (person[u'username'], person[u'human_name'], person[u'email'])