Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1422385

Summary: beaker-wizard fails with python-bugzilla 2.0: AttributeError: Bug object has no attribute 'attachments'
Product: [Retired] Beaker Reporter: Martin Kyral <mkyral>
Component: wizardAssignee: Dan Callaghan <dcallagh>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: crobinso, dcallagh, mjia, ohudlick, rjoost
Target Milestone: 24.2Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed patch none

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:50 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.