Bug 472301 - bodhi -T fails with traceback
Summary: bodhi -T fails with traceback
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: bodhi
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Luke Macken
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-11-19 22:03 UTC by James Antill
Modified: 2016-09-20 02:39 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-12-24 12:57:20 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Change testable() to return one package at a time (621 bytes, patch)
2008-11-19 23:02 UTC, Toshio Ernie Kuratomi
no flags Details | Diff

Description James Antill 2008-11-19 22:03:15 UTC
Description of problem:
% bodhi -T
Traceback (most recent call last):
  File "/usr/bin/bodhi", line 313, in <module>
    main()
  File "/usr/bin/bodhi", line 219, in main
    log.info(bodhi.update_str(update, minimal=opts.verbose))
  File "/usr/lib/python2.5/site-packages/fedora/client/bodhi.py", line 311, in update_str
    if update['updateid']:
  File "/usr/lib/python2.5/site-packages/fedora/client/__init__.py", line 93, in __getitem__
    value = super(DictContainer, self).__getitem__(key)
KeyError: 'updateid'

...if I fix that (with 'updateid' in update) it just fails on 'release' a few lines later. Not sure if this is bodhi or python-fedora...

Version-Release number of selected component (if applicable):

Installed Packages
bodhi-client.noarch                  0.5.3-1.fc9                  installed     
python-fedora.noarch                 0.3.6-2.fc9                  installed     

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Toshio Ernie Kuratomi 2008-11-19 22:49:13 UTC
It's a bodhi bug.  the bodhi command line client is sending in the raw results from having called the bodhi.list() method earlier.  It needs to do something more like this::

  results = bodhi.list([...])
  for update in results['updates']:
      bodhi.update_str(update)

Looking for the problem code now.

Comment 2 Toshio Ernie Kuratomi 2008-11-19 23:02:46 UTC
Created attachment 324111 [details]
Change testable() to return one package at a time

Patch for /usr/lib/python2.5/site-packages/fedora/client/bodhi.py

Comment 3 Toshio Ernie Kuratomi 2008-11-19 23:13:02 UTC
Just to eat my words, I discovered that this could be fixed either in the bodhi client or in python-fedora.  The attached patch fixes it in python-fedora which I am slightly leaning towards as the right place.  Of course, this does change the API of bodhi.testable() :-(

Luke, if you think this is right, I'll commit it and spin a new python-fedora package soon.  If you'd rather fix it in bodhi client, it's this:

https://fedorahosted.org/bodhi/browser/bodhi/tools/client.py#L212

    elif opts.testable:
        for update in bodhi.testable():
            log.info(bodhi.update_str(update, minimal=opts.verbose))

this would have to change to something like this::

    elif opts.testable:
        for update in bodhi.testable()['updates']:
            log.info(bodhi.update_str(update, minimal=opts.verbose))

Comment 4 Luke Macken 2008-11-20 21:39:16 UTC
The BodhiClient.testable method currently yields BaseClient.send_request responses, where as the majority of the API returns a single response.  The only other generator is BodhiClient.candidates, and that yields builds.  So, to be semi-consistent with the inconsistencies of the existing API, I'd say your patch is the way to go.  The bodhi-client is a complete mess as it is, so lets do it right in python-fedora.  Thanks!

Comment 5 Fedora Update System 2008-11-21 00:43:37 UTC
python-fedora-0.3.8-1.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/python-fedora-0.3.8-1.fc10

Comment 6 Fedora Update System 2008-11-22 16:43:56 UTC
python-fedora-0.3.8-1.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update python-fedora'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/f10/FEDORA-2008-9881

Comment 7 Toshio Ernie Kuratomi 2008-11-23 07:35:52 UTC
Note: I've discovered a bug in our patches to NSS in curl that causes bodhi -T to fail.  bodhi -T with this version of python-fedora will work on EL-5.  I have a bug open and a patch to curl: 

  https://bugzilla.redhat.com/show_bug.cgi?id=472489

Failing that, I have a dirty workaround that initializes curl before anything else utilizes libnss.  We can add this code to the bodhi-client if we must::

  # Authors: Luke Macken <lmacken>

  import pycurl
  c = pycurl.Curl()
  c.setopt(pycurl.WRITEDATA, open('/dev/null', 'w'))
  c.setopt(pycurl.URL, 'https://admin.fedoraproject.org/')
  c.perform()

  import sys

Comment 8 Fedora Update System 2008-12-24 12:57:13 UTC
python-fedora-0.3.8-1.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2008-12-24 18:42:04 UTC
python-fedora-0.3.8-1.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.


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