I'm kind of stumped on this one. I have a bit of code in Fedora infrastructure (so running on RHEL6, python 2.6, in case that's relevant) which works with python-bugzilla 1.0 but fails with 1.1. Unfortunately it doesn't fail at all for me on my F20 dev machine.
Here's the backtrace:
Traceback (most recent call last): File "/usr/local/bin/review-stats.py", line 612, in <module> bz = bugzilla.RHBugzilla(url=config['url'], cookiefile=None, user=config['username'], password=config['password']) File "/usr/lib/python2.6/site-packages/bugzilla/rhbugzilla.py", line 59, in __init__ _add_both_alias('fixed_in', 'cf_fixed_in') File "/usr/lib/python2.6/site-packages/bugzilla/rhbugzilla.py", line 56, in _add_both_alias self._add_field_alias(newname, origname, is_api=False) AttributeError: 'RHBugzilla' object has no attribute '_add_field_alias'
This looks like it's down in the bowels of python-bugzilla itself and not some trivial issue with my code, so I'm at a loss. Just in case, if I ask for a Bugzilla object instead of a RHBugzilla one, I get a different backtrace:
Traceback (most recent call last): File "./review-stats.py", line 614, in <module> (bugs, bugdata, usermap) = run_query(bz) File "./review-stats.py", line 199, in run_query bugs = filter(lambda b: b.id not in trackers, bz.query(querydata)) File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 995, in query return [_Bug(bugzilla=self, dict=b) for b in r['bugs']] File "/usr/lib/python2.6/site-packages/bugzilla/bug.py", line 42, in __init__ self._update_dict(dict) File "/usr/lib/python2.6/site-packages/bugzilla/bug.py", line 129, in _update_dict aliases = self.bugzilla._get_bug_aliases() AttributeError: 'Bugzilla' object has no attribute '_get_bug_aliases'
You can see the code at https://git.fedorahosted.org/cgit/fedora-infrastructure.git/tree/scripts/rev... if that would be useful.
Any ideas would be greatly appreciated, because I'm fresh out.
- J<
On 11/28/2014 09:22 PM, Jason L Tibbitts III wrote:
I'm kind of stumped on this one. I have a bit of code in Fedora infrastructure (so running on RHEL6, python 2.6, in case that's relevant) which works with python-bugzilla 1.0 but fails with 1.1. Unfortunately it doesn't fail at all for me on my F20 dev machine.
Here's the backtrace:
Traceback (most recent call last): File "/usr/local/bin/review-stats.py", line 612, in <module> bz = bugzilla.RHBugzilla(url=config['url'], cookiefile=None, user=config['username'], password=config['password']) File "/usr/lib/python2.6/site-packages/bugzilla/rhbugzilla.py", line 59, in __init__ _add_both_alias('fixed_in', 'cf_fixed_in') File "/usr/lib/python2.6/site-packages/bugzilla/rhbugzilla.py", line 56, in _add_both_alias self._add_field_alias(newname, origname, is_api=False) AttributeError: 'RHBugzilla' object has no attribute '_add_field_alias'
This looks like it's down in the bowels of python-bugzilla itself and not some trivial issue with my code, so I'm at a loss. Just in case, if I ask for a Bugzilla object instead of a RHBugzilla one, I get a different backtrace:
Traceback (most recent call last): File "./review-stats.py", line 614, in <module> (bugs, bugdata, usermap) = run_query(bz) File "./review-stats.py", line 199, in run_query bugs = filter(lambda b: b.id not in trackers, bz.query(querydata)) File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 995, in query return [_Bug(bugzilla=self, dict=b) for b in r['bugs']] File "/usr/lib/python2.6/site-packages/bugzilla/bug.py", line 42, in __init__ self._update_dict(dict) File "/usr/lib/python2.6/site-packages/bugzilla/bug.py", line 129, in _update_dict aliases = self.bugzilla._get_bug_aliases() AttributeError: 'Bugzilla' object has no attribute '_get_bug_aliases'
You can see the code at https://git.fedorahosted.org/cgit/fedora-infrastructure.git/tree/scripts/rev... if that would be useful.
Any ideas would be greatly appreciated, because I'm fresh out.
Is this python-bugzilla installed from EPEL?
In a brief test just trying to instantiate RHBugzilla on RHEL6, I didn't see any backtrace like the first example.
Any chance you manually installed a previous version of bugzilla and maybe the imports are getting messed up? Check /usr/local/... for example. Try fully removing all traces of python-bugzilla and reinstalling.
Additionally try latest git, maybe it helps:
git clone git://git.fedorahosted.org/python-bugzilla.git cd python-bugzilla [run your script]
- Cole
"CR" == Cole Robinson crobinso@redhat.com writes:
CR> Is this python-bugzilla installed from EPEL?
I believe it is. This is running on Fedora infrastructure so I don't have complete visibility, but the exact package is python-bugzilla-1.1.0-1.el6.noarch
It looks like it's installed properly, but:
[tibbs@app01.stg ~]$ rpm -V python-bugzilla S.5....T. /usr/lib/python2.6/site-packages/bugzilla/base.py
Which is... interesting. I wonder if there's some hotfix being applied outside of the rpm which is breaking things. Let me follow up with the infra folks.
- J<
OK, so it turns out that there is a hotfix in Fedora infra which is overwriting base.py with a slightly modified 1.0 version. Below is the patch that's applied. I note that the second hunk seems to be in 1.1, but not the first. I'm not really familiar with this patch or the reasons it was applied, but maybe someone here has some idea of whether or not it's still necessary.
commit d3c6ed32625f68fa7aeb4d1d62a012aa15ad1bcd Author: Toshio くらとみ toshio@lockbox01.phx2.fedoraproject.org Date: Wed May 21 16:50:56 2014 +0000
If we specify None for cookiefile, then we don't want cookies saved to disk. They still have to be used within the process, though.
diff --git a/modules/hotfix/files/python-bugzilla/base.py b/modules/hotfix/files/python-bugzilla/base.py index db4cd86..6a862ff 100644 --- a/modules/hotfix/files/python-bugzilla/base.py +++ b/modules/hotfix/files/python-bugzilla/base.py @@ -116,6 +116,8 @@ class RequestsTransport(Transport): Transport.__init__(self, use_datetime=False)
self.verbose = debug + if cookiejar is None: + cookiejar = _build_cookiejar(None) self._cookiejar = cookiejar
# transport constructor needs full url too, as xmlrpc does not pass @@ -128,7 +130,7 @@ class RequestsTransport(Transport):
self.request_defaults = { 'cert': sslcafile if self.use_https else None, - 'cookies': cookiejar if cookiejar else None, + 'cookies': cookiejar, 'verify': sslverify, 'headers': { 'Content-Type': 'text/xml',
On 11/29/2014 03:32 PM, Jason L Tibbitts III wrote:
OK, so it turns out that there is a hotfix in Fedora infra which is overwriting base.py with a slightly modified 1.0 version. Below is the patch that's applied. I note that the second hunk seems to be in 1.1, but not the first. I'm not really familiar with this patch or the reasons it was applied, but maybe someone here has some idea of whether or not it's still necessary.
commit d3c6ed32625f68fa7aeb4d1d62a012aa15ad1bcd Author: Toshio くらとみ toshio@lockbox01.phx2.fedoraproject.org Date: Wed May 21 16:50:56 2014 +0000
If we specify None for cookiefile, then we don't want cookies saved to disk. They still have to be used within the process, though.
diff --git a/modules/hotfix/files/python-bugzilla/base.py b/modules/hotfix/files/python-bugzilla/base.py index db4cd86..6a862ff 100644 --- a/modules/hotfix/files/python-bugzilla/base.py +++ b/modules/hotfix/files/python-bugzilla/base.py @@ -116,6 +116,8 @@ class RequestsTransport(Transport): Transport.__init__(self, use_datetime=False)
self.verbose = debug
if cookiejar is None:
cookiejar = _build_cookiejar(None) self._cookiejar = cookiejar # transport constructor needs full url too, as xmlrpc does not pass
@@ -128,7 +130,7 @@ class RequestsTransport(Transport):
self.request_defaults = { 'cert': sslcafile if self.use_https else None,
'cookies': cookiejar if cookiejar else None,
'cookies': cookiejar, 'verify': sslverify, 'headers': { 'Content-Type': 'text/xml',
I think python-bugzilla 1.1.0 should be fixed in this respect, toshio reported the root issue and some patches went in:
commit fbd0b048198cde065687b69e5daa08ac6656964e Author: Toshio Kuratomi toshio@fedoraproject.org Date: Sun Jun 1 12:57:29 2014 -0400
transport: Still store cookies in memory if cookiefile=None
So maybe ask infrastructure to drop their patch and give it a test?
- Cole
python-bugzilla@lists.fedorahosted.org