Bug 621298 - Looks like python2.7 is breaking python-bugzilla package.
Summary: Looks like python2.7 is breaking python-bugzilla package.
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-bugzilla   
(Show other bugs)
Version: 14
Hardware: All Linux
low
medium
Target Milestone: ---
Assignee: Will Woods
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: testing_xmlrpc_cookie_handling hello_...
Keywords:
: 620434 620932 621030 getreply (view as bug list)
Depends On:
Blocks: F14Alpha, F14AlphaBlocker Python27
TreeView+ depends on / blocked
 
Reported: 2010-08-04 17:42 UTC by Daniel Walsh
Modified: 2010-08-16 17:11 UTC (History)
8 users (show)

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 18:57:44 UTC
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 21:08 UTC, Will Woods
no flags Details
patch (against git master) that holds the fixes described previously (3.92 KB, patch)
2010-08-05 18:15 UTC, Will Woods
no flags Details | Diff

Description Daniel Walsh 2010-08-04 17:42:30 UTC
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 17:43:05 UTC
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 18:04:53 UTC
*** Bug 620434 has been marked as a duplicate of this bug. ***

Comment 3 Dave Malcolm 2010-08-04 18:55:14 UTC
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 21:08:41 UTC
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 21:12:47 UTC
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 17:53:21 UTC
*** Bug 621030 has been marked as a duplicate of this bug. ***

Comment 7 James Laska 2010-08-05 18:09:18 UTC
Carrying forward F14Alpha status from 621030

Comment 8 Will Woods 2010-08-05 18:15:05 UTC
Created attachment 436932 [details]
patch (against git master) that holds the fixes described previously

Comment 9 James Laska 2010-08-05 18:35:46 UTC
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 18:38:17 UTC
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 18:48:40 UTC
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 18:54:34 UTC
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 12:43:00 UTC
This should be in ON_QA ... not sure why bodhi didn't change the state.

Comment 14 Fedora Update System 2010-08-09 18:57:39 UTC
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 18:53:31 UTC
*** Bug 620932 has been marked as a duplicate of this bug. ***

Comment 16 Will Woods 2010-08-16 17:11:12 UTC
*** 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.