Bug 621298 - Looks like python2.7 is breaking python-bugzilla package.
Looks like python2.7 is breaking python-bugzilla package.
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: python-bugzilla (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Will Woods
Fedora Extras Quality Assurance
testing_xmlrpc_cookie_handling hello_...
:
: 620434 620932 621030 getreply (view as bug list)
Depends On:
Blocks: F14Alpha/F14AlphaBlocker Python27
  Show dependency treegraph
 
Reported: 2010-08-04 13:42 EDT by Daniel Walsh
Modified: 2010-08-16 13:11 EDT (History)
8 users (show)

See Also:
Fixed In Version: python-bugzilla-0.6.1-3.fc14
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-09 14:57:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
base.py modified to handle python 2.7 httplib/xmlrpclib changes (59.40 KB, text/plain)
2010-08-04 17:08 EDT, Will Woods
no flags Details
patch (against git master) that holds the fixes described previously (3.92 KB, patch)
2010-08-05 14:15 EDT, Will Woods
no flags Details | Diff

  None (edit)
Description Daniel Walsh 2010-08-04 13:42:30 EDT
Description of problem:

Traceback (most recent call last):
  File "/usr/bin/bugzilla", line 682, in <module>
    main()
  File "/usr/bin/bugzilla", line 499, in main
    buglist = bz.query(q)
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 525, in query
    r = self._query(query)
  File "/usr/lib/python2.7/site-packages/bugzilla/rhbugzilla.py", line 420, in _query
    return self._proxy.Bug.search(query)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 957, in request
    errcode, errmsg, headers = h.getreply()
AttributeError: HTTPSConnection instance has no attribute 'getreply'
Comment 1 Daniel Walsh 2010-08-04 13:43:05 EDT
bugzilla query -user dwalsh@redhat.com -c selinux-policy -t NEW,ASSIGNED,NEEDINFO -p RHEL -v 6 -a dwalsh@redhat.com --outputformat 'http://bugzilla.redhat.com/%{bug_id}'
Comment 2 Dave Malcolm 2010-08-04 14:04:53 EDT
*** Bug 620434 has been marked as a duplicate of this bug. ***
Comment 3 Dave Malcolm 2010-08-04 14:55:14 EDT
bugzilla/base.py: CookieTransport subclasses xmlrpclib.Transport.

From the comment for its "request" method:
    # This is the same request() method from xmlrpclib.Transport,
    # with a couple additions noted below

In its request method, it calls make_connection, then (eventually) calls getreply on the returned object.

However, Python 2.7's xmlrpclib.Transport has changed since this method was copied: r73638 [1] split the request method up, moving most of the body into a single_request method [2].

In particular, it changed make_connection to return a httplib.HTTPConnection, rather than a httplib.HTTP, and from calling getreply() to getresponse() upon this connection instance. (see the hunk at lines 1240 vs line 1350 of [2]).

A similar change was made to the make_connection method of httplib.SafeTransport.

[1] http://svn.python.org/view?view=rev&revision=73638
[2] http://svn.python.org/view/python/trunk/Lib/xmlrpclib.py?r1=73638&r2=73637&pathrev=73638
Comment 4 Will Woods 2010-08-04 17:08:41 EDT
Created attachment 436668 [details]
base.py modified to handle python 2.7 httplib/xmlrpclib changes

I've modified bugzilla/base.py to do the following:
1) move request() to request_with_cookies()
2) add a single_request_with_cookies() for python 2.7+
3) add some code to override the appropriate method (request or single_request) depending on what xmlrpclib provides.

I've tested it on two machines - one with python 2.6, one with python 2.7 - can one of the reporters/other interested parties please confirm the fix?

Also, Dave, I'd love it if you'd look over the way I'm overriding request/single_request in (Safe)CookieTransport and tell me if there's a cleaner way to do that.
Comment 5 Will Woods 2010-08-04 17:12:47 EDT
Obviously, the best thing would be to modify xmlrpclib.Transport so it can send custom user-supplied headers along with requests - or so it handles cookies on its own. But this works.
Comment 6 Will Woods 2010-08-05 13:53:21 EDT
*** Bug 621030 has been marked as a duplicate of this bug. ***
Comment 7 James Laska 2010-08-05 14:09:18 EDT
Carrying forward F14Alpha status from 621030
Comment 8 Will Woods 2010-08-05 14:15:05 EDT
Created attachment 436932 [details]
patch (against git master) that holds the fixes described previously
Comment 9 James Laska 2010-08-05 14:35:46 EDT
Confirmed that using the updated bugzilla/base.py code inside an anaconda updates.img [1], I am able to file bugs directly from the install environment (see example bug#621659).  This would resolve the Alpha release criteria issue. 

Note, the updates.img is intended for use with F-14-Alpha TC#2, and contains code to intentionally trigger an exception.

[1] http://jlaska.fedorapeople.org/updates/621298.img
Comment 10 Dave Malcolm 2010-08-05 14:38:17 EDT
Tested on Python 2.7 with:
WORKS: "bugzilla info -p"
WORKS: "bugzilla login" with bad username of password
WORKS: "bugzilla login" with correct username/password combination
Comment 11 Dave Malcolm 2010-08-05 14:48:40 EDT
I've applied the patch from comment #8 to dist-git and pushed to "f14/master" and "master"

Building into f14 as:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=2382843

Building into rawhide as:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=2382848
Comment 12 Fedora Update System 2010-08-05 14:54:34 EDT
python-bugzilla-0.6.1-3.fc14 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/python-bugzilla-0.6.1-3.fc14
Comment 13 James Laska 2010-08-06 08:43:00 EDT
This should be in ON_QA ... not sure why bodhi didn't change the state.
Comment 14 Fedora Update System 2010-08-09 14:57:39 EDT
python-bugzilla-0.6.1-3.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Will Woods 2010-08-10 14:53:31 EDT
*** Bug 620932 has been marked as a duplicate of this bug. ***
Comment 16 Will Woods 2010-08-16 13:11:12 EDT
*** Bug 623299 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.