Re: Problems with bugzilla and FAS account

2009-05-23 Thread Michael Schwendt
On Wed, 20 May 2009 08:13:40 -0500 (CDT), Mike wrote:

 On Wed, 20 May 2009, Michael Schwendt wrote:
 
  As the fedoraproject aliases have trouble forwarding mail to GMX, I've
  changed my FAS account to use my Google Mail address. I've confirmed
  the change meanwhile.
 
  In bugzilla, however, my account still uses my GMX address. And I cannot
  change that. When I try to change it, I get:
 
  There is already an account with the login name mschwendt AT gmail.com.
 
  That looks as if the FAS sync script created a separate account for me.
  Right?
 
  Are there special requirements for FAS users? Do I need to change email
  addr in bugzilla _before_ changing it in FAS? Or what is necessary to
  get this right?
 
 
 I'd guess that you need to change it in bugzilla first,

If the FAS backend managed to create a new account in bugzilla, why would
I need to _change_ an existing one myself? Can't it sync bugzilla with my
email change in FAS? (which is what I expected it to do)

Anyone who changes email in FAS gets a new bugzilla account for the changed
email address? Is that how it's implemented currently?

 and I'd bet you'll
 have to contact the bugzilla owner to get it changed in its current state.

Well, I could ask bugzilla to send me a password, then reassign the
superfluous account to a throw-away address.

 Let me talk to Toshio first though to confirm that.  We might be able to
 fix it on our end, not sure.

___
Fedora-infrastructure-list mailing list
Fedora-infrastructure-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-infrastructure-list


Re: Problems with bugzilla and FAS account

2009-05-23 Thread Ricky Zhou
On 2009-05-23 12:08:30 PM, Michael Schwendt wrote:
 If the FAS backend managed to create a new account in bugzilla, why would
 I need to _change_ an existing one myself? Can't it sync bugzilla with my
 email change in FAS? (which is what I expected it to do)
This is because at the time of writing, there was no XMLRPC method
exposed for changing a user's email.  I just checked now, and there
might be a new method available that we can use.  I'll look at
adding this to our scripts soon.

 Anyone who changes email in FAS gets a new bugzilla account for the changed
 email address? Is that how it's implemented currently?
This is currently implemented as follows: When a user changes their
email in FAS, or changes their membership in the fedorabugs group, a
trigger runs which adds the user to a special queue table.  We then run
a script periodically that empties out the queue and creates a BZ
account if one doesn't already exist, and grants privileges to the
accounts.  The relevant code for this is in the FAS repo:
git://git.fedorahosted.org/git/fas.git
in scripts/export-bugzilla.* and fas2.sql.

Thanks,
Ricky


pgpCeOQRuzR6Y.pgp
Description: PGP signature
___
Fedora-infrastructure-list mailing list
Fedora-infrastructure-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-infrastructure-list


Re: Problems with bugzilla and FAS account

2009-05-23 Thread Toshio Kuratomi

On 05/23/2009 08:32 AM, Ricky Zhou wrote:

On 2009-05-23 12:08:30 PM, Michael Schwendt wrote:

If the FAS backend managed to create a new account in bugzilla, why would
I need to _change_ an existing one myself? Can't it sync bugzilla with my
email change in FAS? (which is what I expected it to do)

This is because at the time of writing, there was no XMLRPC method
exposed for changing a user's email.  I just checked now, and there
might be a new method available that we can use.  I'll look at
adding this to our scripts soon.


Anyone who changes email in FAS gets a new bugzilla account for the changed
email address? Is that how it's implemented currently?

This is currently implemented as follows: When a user changes their
email in FAS, or changes their membership in the fedorabugs group, a
trigger runs which adds the user to a special queue table.  We then run
a script periodically that empties out the queue and creates a BZ
account if one doesn't already exist, and grants privileges to the
accounts.  The relevant code for this is in the FAS repo:
git://git.fedorahosted.org/git/fas.git
in scripts/export-bugzilla.* and fas2.sql.



Apologies for not joining in sooner.  What ricky's outlined as the 
current situation is correct.  Michael, what you outlined as a way to 
keep the accounts straight would work.  I think making the script not 
create new accounts (forcing the user to reconcile the fas email and 
lack of bugzilla account manually) is the way to go.


Here's an untested, updated export-bugzilla.py script.  It emails the 
users when an account mismatch occurs (I believe this runs in cron 
hourly, so this would send an email once an hour).  Does this look good 
to you guys?


I'm going to a family reunion this weekend.  If someone wants to update 
the script sooner, they can (It will need an infrastructure change 
request if we put this in place before the release but should be fairly 
low risk/easy to revert.)


-Toshio
#!/usr/bin/python -t
__requires__ = 'TurboGears'
import pkg_resources
pkg_resources.require('CherryPy = 2.0,  3.0alpha')

import sys
import getopt
import xmlrpclib
import smtplib
from email.Message import Message
import turbogears
import bugzilla
from turbogears import config
turbogears.update_config(configfile=/etc/export-bugzilla.cfg)
from turbogears.database import session
from fas.model import BugzillaQueue

BZSERVER = config.get('bugzilla.url', 
'https://bugdev.devel.redhat.com/bugzilla-cvs/xmlrpc.cgi')
BZUSER = config.get('bugzilla.username')
BZPASS = config.get('bugzilla.password')
MAILSERVER = config.get('mail.server', localhost)
ADMINEMAIL = config.get(mail.admin_email, 'ad...@fedoraproject.org')

if __name__ == '__main__':
opts, args = getopt.getopt(sys.argv[1:], '', ('usage', 'help'))
if len(args) != 2 or ('--usage','') in opts or ('--help','') in opts:
print 
Usage: export-bugzilla.py GROUP BUGZILLA_GROUP

sys.exit(1)
ourGroup = args[0]
bzGroup = args[1]

server = bugzilla.Bugzilla(url=BZSERVER, user=BZUSER, password=BZPASS)
bugzilla_queue = BugzillaQueue.query.join('group').filter_by(
name=ourGroup)

no_bz_account = []
for entry in bugzilla_queue:
# Make sure we have a record for this user in bugzilla
if entry.action == 'r':
# Remove the user's bugzilla group
try:
server.updateperms(entry.email, 'rem', (bzGroup,))
except xmlrpclib.Fault, e:
if e.faultCode == 504:
# It's okay, not having this user is equivalent to setting
# them to not have this group.
pass
else:
raise

elif entry.action == 'a':
# Make sure the user exists
try:
server.getuser(entry.email)
except xmlrpclib.Fault, e:
if e.faultCode == 51:
# This user doesn't have a bugzilla account yet
# add them to a list and we'll let them know.
no_bz_account.append(entry)
continue
else:
print 'Error:', e, entry.email, entry.person.human_name
raise
server.updateperms(entry.email, 'add', (bzGroup,))
else:
print 'Unrecognized action code: %s %s %s %s %s' % (entry.action,
entry.email, entry.person.human_name, 
entry.person.username, entry.group.name)

# Remove them from the queue
session.delete(entry)
session.flush()

# Mail the people without bugzilla accounts
msg = Message()
for person in no_bz_account:
smtplib.SMTP(MAILSERVER)
message = '''Hello, %(name)s,

As a Fedora packager, we grant you permissions to make changes to bugs in
bugzilla to all Fedora bugs.  This lets you work together with other Fedora
developers in an easier fashion.  However, to enable 

Problems with bugzilla and FAS account

2009-05-20 Thread Michael Schwendt
As the fedoraproject aliases have trouble forwarding mail to GMX, I've
changed my FAS account to use my Google Mail address. I've confirmed
the change meanwhile.

In bugzilla, however, my account still uses my GMX address. And I cannot
change that. When I try to change it, I get:

There is already an account with the login name mschwendt AT gmail.com.

That looks as if the FAS sync script created a separate account for me.
Right?

Are there special requirements for FAS users? Do I need to change email
addr in bugzilla _before_ changing it in FAS? Or what is necessary to
get this right?

___
Fedora-infrastructure-list mailing list
Fedora-infrastructure-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-infrastructure-list