Bug 1422385 - beaker-wizard fails with python-bugzilla 2.0: AttributeError: Bug object has no attribute 'attachments'
Summary: beaker-wizard fails with python-bugzilla 2.0: AttributeError: Bug object has ...
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Community
Component: wizard   
(Show other bugs)
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified vote
Target Milestone: 24.2
Assignee: Dan Callaghan
QA Contact: tools-bugs
URL:
Whiteboard:
Keywords: Patch
: 1430454 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-15 08:17 UTC by Martin Kyral
Modified: 2017-03-30 03:22 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-03-30 03:22:57 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed patch (612 bytes, patch)
2017-02-15 08:21 UTC, Martin Kyral
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Bugzilla 1405986 None None None Never

Internal Trackers: 1405986

Description Martin Kyral 2017-02-15 08:17:49 UTC
Description of problem:

0 [mkyral@host pcre (master)]$ bw -byg 1400267
Contacting bugzilla...
Fetching details for BZ#1400267
Traceback (most recent call last):
  File "/usr/bin/beaker-wizard", line 9, in <module>
    load_entry_point('bkr.client==23.3', 'console_scripts', 'beaker-wizard')()
  File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 3064, in main
    test = Test(options)
  File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1130, in __init__
    self.init()
  File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 2734, in init
    self.testname = Name(self.options)
  File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1130, in __init__
    self.init()
  File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1941, in init
    self.bugs.fetchBugDetails()
  File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1866, in fetchBugDetails
    self.reproducers.find(self.bug)
  File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1992, in find
    if not bug or not bug.attachments:
  File "/usr/lib/python2.7/site-packages/bugzilla/bug.py", line 110, in __getattr__
    raise AttributeError(msg)
AttributeError: Bug object has no attribute 'attachments'.
If 'attachments' is a bugzilla attribute, it may not have been cached when the bug was fetched. You may want to adjust your include_fields for getbug/query.
Version-Release number of selected component (if applicable):


How reproducible:
Always


Steps to Reproduce:
1. see description
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Martin Kyral 2017-02-15 08:21 UTC
Created attachment 1250514 [details]
proposed patch

Wrap "if not bug or not bug.attachments:" in try - except and return False not even if bug.attachments is empty, but also if it is not defined at all.

I suspect some BZ update changed the API so instead of empty attachments attribute there is none now.

Comment 2 Martin Kyral 2017-02-15 08:24:53 UTC
With the patch:

[mkyral@host pcre (master)]$ bw -byg 1400267
Contacting bugzilla...
Fetching details for BZ#1400267

Ready to create the test, please review
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/CoreOS/pcre/Regression/bz1400267-PCRE-8-32-fails-to-recognize-non-ASCII-printable

             Namespace : CoreOS
               Package : pcre
             Test type : Regression

Comment 3 Martin Kyral 2017-02-16 13:15:51 UTC
It seems the root cause is API breakage in python-buzilla-2.0.0.

Comment 4 Dan Callaghan 2017-02-23 15:58:58 UTC
Hmm yeah I guess it is due to this change, "Bugzilla.bug_autorefresh now defaults to False" as described here:

http://blog.wikichoon.com/2016/06/python-bugzilla-api-changes-in-git.html

I think it means we need to pass include_fields=[..., 'attachments'] somewhere.

Comment 5 Dan Callaghan 2017-02-24 14:29:28 UTC
https://gerrit.beaker-project.org/5648

Comment 6 Roman Joost 2017-03-06 23:56:48 UTC
We'll have to do QE on the items before we can tag a release.

Comment 7 Roman Joost 2017-03-22 05:42:26 UTC
Verified with git build from patchset 5648.

Reproduced error first with install python-bugzilla 2.0 in a virtualenv and invoking beaker-wizard with the python version of the virtualenv:

» python /usr/bin/beaker-wizard -byg 1400267
Contacting bugzilla...
Traceback (most recent call last):
  File "/usr/bin/beaker-wizard", line 9, in <module>
    load_entry_point('beaker-client==24.0', 'console_scripts', 'beaker-wizard')()
  [...]
  File "/tmp/bwtest/lib/python2.7/site-packages/bugzilla/bug.py", line 110, in __getattr__
    raise AttributeError(msg)
AttributeError: Bug object has no attribute 'attachments'.

Previous beaker-client version was 24.0.

Updated to git build from patchset 5648 and redone the test which presents the wizard interface.

Comment 8 Dan Callaghan 2017-03-29 01:16:46 UTC
*** Bug 1430454 has been marked as a duplicate of this bug. ***

Comment 9 Dan Callaghan 2017-03-30 03:22:57 UTC
Beaker 24.2 has been released.


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