Re: FAS2 problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Toshio Kuratomi wrote:
> I ran into this when showing someone the new interface last week.
> The way we ended up working with it was to create a small FasClient
> class using BaseClient from the python-fedora package.

That was me.  Thanks Toshio.

Michael, I sent you a private mail last week regarding that, since I
had been using the PackageOwners.py from extras-repoclosure and
noticed it was broken due to the change in dump url and usage.

I'll attach that mail again (which includes a patch to make
PackageOwners.py work with the new setup).

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I've had a perfectly wonderful evening.  But this wasn't it.
    -- Groucho Marx

--- Begin Message ---
Hi Michael,

I was using PackageOwners.py to get owner data for a small project and
found that it wasn't working for me after some recent updates.  I now
get a 500 "Internal Server Error" returned from
https://admin.fedoraproject.org/accounts/dump-group.cgi

Attached is a patch to use the BaseClient class from python-fedora to
access the account dump from
https://admin.fedoraproject.org/accounts/group/dump/

It works in that all the tests from PackageOwnersTests.py succeed
(requiring a username and password).  I am not sure if the error
checking is really sufficient, but it's hopefully a decent start.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's not God. I'm down with God; it's the damn fan club that pisses me
off.
    -- Dan Berger

Index: PackageOwners.py
===================================================================
RCS file: /cvs/fedora/extras-repoclosure/PackageOwners.py,v
retrieving revision 1.14
diff -u -p -r1.14 PackageOwners.py
--- PackageOwners.py	25 Nov 2007 01:07:21 -0000	1.14
+++ PackageOwners.py	27 Mar 2008 22:22:29 -0000
@@ -21,6 +21,7 @@ import os, sys, time
 import shutil
 import tempfile
 from urllib import FancyURLopener
+from fedora.tg.client import BaseClient, AuthError, ServerError
 
 
 class AccountsURLopener(FancyURLopener):
@@ -245,18 +246,22 @@ class PackageOwners:
 
 
     def _downloadfrompkgdb(self):
-        fasdump = self._getlinesfromurl('https://admin.fedoraproject.org/accounts/dump-group.cgi')
+        try:
+            client = BaseClient('https://admin.fedoraproject.org/accounts/',
+                                self.username, self.password)
+            data = client.send_request('group/dump', auth=True)
+        except AuthError, e:
+            print 'Authentication error:', e
+            return False
+        except ServerError, e:
+            print 'Server error:', e
+            return False
         self.usermap = {}
-        for line in fasdump:
-            fields = line.split(',')
-            try:
-                user = fields[0]
-                addr = fields[1]
-            except IndexError:
-                print line
-                raise
-            if (addr.find('@') < 0):  # unexpected, no addr
-                print 'No email in:', line
+        for person in data['people']:
+            user = person[0]
+            addr = person[1]
+            if '@' not in addr:  # unexpected, no addr
+                print 'No email in:', ', '.join(person)
                 raise Exception
             self.usermap[user] = addr
         self._parse(self._getlinesfromurl(self.url))

--- End Message ---

Attachment: pgpWraNvBu5yt.pgp
Description: PGP signature

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

[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux