Bug 1024088

Summary: Bug.search returns components instead of target release
Product: [Community] Bugzilla Reporter: Stephen Gordon <sgordon>
Component: WebServiceAssignee: Simon Green <sgreen>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.4CC: bugs.michael, crobinso, dzickus, ebaak, jmcdonal, jskarvad, rjoost, wwoods
Target Milestone: 4.4   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.4.1011 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-22 01:55:36 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:

Description Stephen Gordon 2013-10-28 19:06:58 UTC
Description of problem:

When executing a query that requests the target release either by using the Python bindings or the provided CLI the component seems to get mangled into the target_release field at some point, for instance:

$ bugzilla query --bug_id 986389 --outputformat "%{bug_id} %{target_release}"
986389 python-bugzilla

If I specify --raw instead of --outputformat I can see that the correct target_release value appears to be returned so this mangling must be happening somewhere inside the library?

Here is the raw output for the same bug (in particular note ATTRIBUTE[target_release]: ['---']):

$ bugzilla query --bug_id 986389 --raw
Bugzilla 986389: 
ATTRIBUTE[_dowhiteboard]: <bound method _Bug._dowhiteboard of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[_update_dict]: <bound method _Bug._update_dict of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[addcc]: <bound method _Bug.addcc of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[addcomment]: <bound method _Bug.addcomment of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[addtag]: <bound method _Bug.addtag of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[alias]: []
ATTRIBUTE[appendwhiteboard]: <bound method _Bug.appendwhiteboard of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[assigned_to]: Will Woods
ATTRIBUTE[attachments]: []
ATTRIBUTE[blocks]: []
ATTRIBUTE[bugzilla]: <bugzilla.rhbugzilla.RHBugzilla object at 0x24db790>
ATTRIBUTE[cc]: ['Michael Schwendt', 'Cole Robinson', 'Don Zickus', 'Frantisek Reznicek', u'Jaroslav \u0160karvada', 'Will Woods']
ATTRIBUTE[cf_category]: ---
ATTRIBUTE[cf_clone_of]: 0
ATTRIBUTE[cf_crm]: 
ATTRIBUTE[cf_doc_type]: Bug Fix
ATTRIBUTE[cf_documentation_action]: ---
ATTRIBUTE[cf_environment]: 
ATTRIBUTE[cf_last_closed]: 20130725T13:53:02
ATTRIBUTE[cf_mount_type]: ---
ATTRIBUTE[cf_regression_status]: ---
ATTRIBUTE[cf_release_notes]: 
ATTRIBUTE[cf_story_points]: ---
ATTRIBUTE[cf_type]: Bug
ATTRIBUTE[cf_verified_branch]: 
ATTRIBUTE[classification]: Fedora
ATTRIBUTE[close]: <bound method _Bug.close of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[comments]: [{'count': 0, 'author': 'Frantisek Reznicek', 'text': 'Description of problem:\n\npython-bugzilla has feature to select bugs using web bugzilla URL.\nThis feature does not work (aborts) when URL contains cmdtype=\n\n# bugzilla query  --from-url=\'https://bugzilla.redhat.com/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=mrgm-3.0.0-all&sharer_id=211011\'\n\nServer error: <Fault 53: \'cmdtype is not a valid parameter for the Bugzilla::Bug::match function.\'>\n\n\nVersion-Release number of selected component (if applicable):\nboth python-bugzilla-0.9.0-1.el6.noarch and python-bugzilla-0.8.0-2.el6.noarch\n\nHow reproducible:\n100%\n\nSteps to Reproduce:\n1. bugzilla query  --from-url=\'https://bugzilla.redhat.com/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=mrgm-3.0.0-all&sharer_id=211011\'\n\nActual results:\nURL to query useless for some queries.\n\nExpected results:\nURL to query should be functional.\n\nAdditional info:\n\nTraceback from bzps.py tool:\npython ./bzps.py --mode-alllists --bz-query-csv-summary-ena --bz-query-csv-save_fn=result.csv --bz-query-url \'https://bugzilla.redhat.com/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=mrgm-3.0.0-all&sharer_id=211011\'\nINFO:bugzilla:Connecting to https://bugzilla.redhat.com/xmlrpc.cgi\nINFO:bugzilla:Bugzilla v0.9.0 initializing\nINFO:bugzilla:Using RHBugzilla for URL containing bugzilla.redhat.com\nINFO:bugzilla:Chose subclass RHBugzilla v0.1\nINFO:bugzilla:Bugzilla query in progress.\nTraceback (most recent call last):\n  File "./bzps.py", line 1295, in <module>\n    main(int_opts);\n  File "./bzps.py", line 671, in main\n    bzquery_out = bz.query(bzquery_in);\n  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 925, in query\n    r = self._query(query)\n  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 915, in _query\n    return self._proxy.Bug.search(query)\n  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__\n    return self.__send(self.__name, args)\n  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request\n    verbose=self.__verbose\n  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 166, in request\n    return self.parse_response(stringio)\n  File "/usr/lib64/python2.6/xmlrpclib.py", line 1361, in parse_response\n    return self._parse_response(file, None)\n  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response\n    return u.close()\n  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close\n    raise Fault(**self._stack[0])\nxmlrpclib.Fault: <Fault 53: \'cmdtype is not a valid parameter for the Bugzilla::Bug::match function.\'>', 'creator': 'Frantisek Reznicek', 'creation_time': <DateTime '20130719T16:14:38' at 24e1e60>, 'bug_id': 986389, 'creator_id': 268837, 'time': <DateTime '20130719T16:14:38' at 24e1d88>, 'id': 6124172, 'is_private': False}, {'count': 1, 'author': 'Cole Robinson', 'text': 'How did you generate that search URL in the bugzilla web UI?', 'creator': 'Cole Robinson', 'creation_time': <DateTime '20130723T19:04:55' at 24e1f80>, 'bug_id': 986389, 'creator_id': 199727, 'time': <DateTime '20130723T19:04:55' at 24e1ef0>, 'id': 6134921, 'is_private': False}, {'count': 2, 'author': 'Frantisek Reznicek', 'text': '(In reply to Cole Robinson from comment #1)\n> How did you generate that search URL in the bugzilla web UI?\n\nVery good question, I took it from MRG meeting minutes, so I do not know how it was generated.', 'creator': 'Frantisek Reznicek', 'creation_time': <DateTime '20130725T12:19:14' at 24ee0e0>, 'bug_id': 986389, 'creator_id': 268837, 'time': <DateTime '20130725T12:19:14' at 24ee098>, 'id': 6141050, 'is_private': False}, {'count': 3, 'author': 'Frantisek Reznicek', 'text': "The obvious workaround is to use the URL, go 'edit search' change nothing and return to that bug-list with much longer BZ URL query which is functional as far as I checked.", 'creator': 'Frantisek Reznicek', 'creation_time': <DateTime '20130725T12:21:27' at 24ee170>, 'bug_id': 986389, 'creator_id': 268837, 'time': <DateTime '20130725T12:21:27' at 24ee128>, 'id': 6141055, 'is_private': False}, {'count': 4, 'author': 'Frantisek Reznicek', 'text': "(In reply to Cole Robinson from comment #1)\n> How did you generate that search URL in the bugzilla web UI?\n\nActually I figured it out, using Bugzilla Web UI clicking on 'Remember Search' + providing custom bug-list name", 'creator': 'Frantisek Reznicek', 'creation_time': <DateTime '20130725T12:24:25' at 24ee200>, 'bug_id': 986389, 'creator_id': 268837, 'time': <DateTime '20130725T12:24:25' at 24ee1b8>, 'id': 6141065, 'is_private': False}, {'count': 5, 'author': 'Cole Robinson', 'text': 'Thanks for the info Frantisek. Looking at the docs, seems like the bugzilla xmlrpc interface does not provide a way to access saved searches. So the only way around this is to resolve the saved search with a browser like you mentioned, then copy that full URL to the command line.', 'creator': 'Cole Robinson', 'creation_time': <DateTime '20130725T13:53:02' at 24ee290>, 'bug_id': 986389, 'creator_id': 199727, 'time': <DateTime '20130725T13:53:02' at 24ee248>, 'id': 6141357, 'is_private': False}]
ATTRIBUTE[component]: python-bugzilla
ATTRIBUTE[components]: ['python-bugzilla']
ATTRIBUTE[creation_time]: 20130719T16:14:00
ATTRIBUTE[creator]: Frantisek Reznicek
ATTRIBUTE[deletecc]: <bound method _Bug.deletecc of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[deltag]: <bound method _Bug.deltag of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[depends_on]: []
ATTRIBUTE[description]: Description of problem:

python-bugzilla has feature to select bugs using web bugzilla URL.
This feature does not work (aborts) when URL contains cmdtype=

# bugzilla query  --from-url='https://bugzilla.redhat.com/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=mrgm-3.0.0-all&sharer_id=211011'

Server error: <Fault 53: 'cmdtype is not a valid parameter for the Bugzilla::Bug::match function.'>


Version-Release number of selected component (if applicable):
both python-bugzilla-0.9.0-1.el6.noarch and python-bugzilla-0.8.0-2.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. bugzilla query  --from-url='https://bugzilla.redhat.com/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=mrgm-3.0.0-all&sharer_id=211011'

Actual results:
URL to query useless for some queries.

Expected results:
URL to query should be functional.

Additional info:

Traceback from bzps.py tool:
python ./bzps.py --mode-alllists --bz-query-csv-summary-ena --bz-query-csv-save_fn=result.csv --bz-query-url 'https://bugzilla.redhat.com/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=mrgm-3.0.0-all&sharer_id=211011'
INFO:bugzilla:Connecting to https://bugzilla.redhat.com/xmlrpc.cgi
INFO:bugzilla:Bugzilla v0.9.0 initializing
INFO:bugzilla:Using RHBugzilla for URL containing bugzilla.redhat.com
INFO:bugzilla:Chose subclass RHBugzilla v0.1
INFO:bugzilla:Bugzilla query in progress.
Traceback (most recent call last):
  File "./bzps.py", line 1295, in <module>
    main(int_opts);
  File "./bzps.py", line 671, in main
    bzquery_out = bz.query(bzquery_in);
  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 925, in query
    r = self._query(query)
  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 915, in _query
    return self._proxy.Bug.search(query)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 166, in request
    return self.parse_response(stringio)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1361, in parse_response
    return self._parse_response(file, None)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 53: 'cmdtype is not a valid parameter for the Bugzilla::Bug::match function.'>
ATTRIBUTE[docs_contact]: 
ATTRIBUTE[external_bugs]: []
ATTRIBUTE[fixed_in]: 
ATTRIBUTE[flags]: []
ATTRIBUTE[get_flag_status]: <bound method _Bug.get_flag_status of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[get_flag_type]: <bound method _Bug.get_flag_type of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[get_flags]: <bound method _Bug.get_flags of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[get_history]: <bound method _Bug.get_history of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[gettags]: <bound method _Bug.gettags of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[getwhiteboard]: <bound method _Bug.getwhiteboard of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[groups]: []
ATTRIBUTE[id]: 986389
ATTRIBUTE[is_cc_accessible]: True
ATTRIBUTE[is_confirmed]: True
ATTRIBUTE[is_creator_accessible]: True
ATTRIBUTE[is_open]: False
ATTRIBUTE[keywords]: []
ATTRIBUTE[last_change_time]: 20130725T13:53:02
ATTRIBUTE[op_sys]: Unspecified
ATTRIBUTE[platform]: Unspecified
ATTRIBUTE[prependwhiteboard]: <bound method _Bug.prependwhiteboard of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[priority]: unspecified
ATTRIBUTE[product]: Fedora
ATTRIBUTE[qa_contact]: Fedora Extras Quality Assurance
ATTRIBUTE[refresh]: <bound method _Bug.refresh of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[reload]: <bound method _Bug.reload of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[resolution]: CANTFIX
ATTRIBUTE[see_also]: []
ATTRIBUTE[setassignee]: <bound method _Bug.setassignee of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[setstatus]: <bound method _Bug.setstatus of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[setwhiteboard]: <bound method _Bug.setwhiteboard of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[severity]: high
ATTRIBUTE[status]: CLOSED
ATTRIBUTE[summary]: python-bugzilla url_to_query aborts on url containing 'cmdtype=...' - Server error: <Fault 53: 'cmdtype is not a valid parameter for the Bugzilla::Bug::match function.'>
ATTRIBUTE[target_milestone]: ---
ATTRIBUTE[target_release]: ['---']
ATTRIBUTE[updateflags]: <bound method _Bug.updateflags of <Bug #986389 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x24e5c50>>
ATTRIBUTE[url]: 
ATTRIBUTE[version]: rawhide
ATTRIBUTE[versions]: ['rawhide']
ATTRIBUTE[weburl]: https://bugzilla.redhat.com/show_bug.cgi?id=986389
ATTRIBUTE[whiteboard]: 


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

python-bugzilla-0.9.0-2.fc20.noarch

Comment 1 Cole Robinson 2013-10-31 15:16:40 UTC
Looks like an rhbz bug. Using Bug.search with target_release in include_fields returns the incorrect value ('components' for some reason). Example code and output, first line is the busted Bug.search output, rest of the lines show that the actual Bug.get data has the expected target_release value.

$ cat test.py 
import bugzilla
bz = bugzilla.Bugzilla(url="bugzilla.redhat.com")

import pprint
pprint.pprint(bz._proxy.Bug.search({'id': ['986389'], 'include_fields': ['target_release', 'id']}))
pprint.pprint(bz._proxy.Bug.get({"ids": ['986389']}))


$ python test.py 
{'bugs': [{'id': 986389, 'target_release': ['python-bugzilla']}]}
{'bugs': [{'actual_time': 0.0,
           'alias': [],
           'assigned_to': 'wwoods',
           'blocks': [],
           'cc': ['bugs.michael',
                  'crobinso',
                  'dzickus',
                  'freznice',
                  'jskarvad',
                  'wwoods'],
           'cf_build_id': '',
           'cf_category': '---',
           'cf_clone_of': 0,
           'cf_conditional_nak': [],
           'cf_crm': '',
           'cf_cust_facing': '---',
           'cf_devel_whiteboard': '',
           'cf_doc_type': 'Bug Fix',
           'cf_documentation_action': '---',
           'cf_environment': '',
           'cf_fixed_in': '',
           'cf_internal_whiteboard': '',
           'cf_last_closed': <DateTime '20130725T13:53:02' at 18f6830>,
           'cf_layered_products': [],
           'cf_mount_type': '---',
           'cf_partner': [],
           'cf_pgm_internal': '',
           'cf_pm_score': '0',
           'cf_qa_whiteboard': '',
           'cf_qe_conditional_nak': [],
           'cf_regression_status': '---',
           'cf_release_notes': '',
           'cf_show_homepage': '---',
           'cf_story_points': '---',
           'cf_type': 'Bug',
           'cf_verified': [],
           'cf_verified_branch': '',
           'classification': 'Fedora',
           'component': ['python-bugzilla'],
           'creation_time': <DateTime '20130719T16:14:00' at 18faea8>,
           'creator': 'freznice',
           'depends_on': [],
           'docs_contact': '',
           'estimated_time': 0.0,
           'groups': [],
           'id': 986389,
           'is_cc_accessible': True,
           'is_confirmed': True,
           'is_creator_accessible': True,
           'is_open': False,
           'keywords': [],
           'last_change_time': <DateTime '20130725T13:53:02' at 18fa5a8>,
           'op_sys': 'Unspecified',
           'platform': 'Unspecified',
           'priority': 'unspecified',
           'product': 'Fedora',
           'qa_contact': 'extras-qa',
           'remaining_time': 0.0,
           'resolution': 'CANTFIX',
           'see_also': [],
           'severity': 'high',
           'status': 'CLOSED',
           'summary': "python-bugzilla url_to_query aborts on url containing 'cmdtype=...' - Server error: <Fault 53: 'cmdtype is not a valid parameter for the Bugzilla::Bug::match function.'>",
           'target_milestone': '---',
           'target_release': ['---'],
           'update_token': '1383232426-1yQg0hPTUXDqPsAC2HpHK0_ZlDYH9RpnXMPkxJtC03Y',
           'url': '',
           'version': ['rawhide'],
           'whiteboard': ''}],
 'faults': []}

Comment 4 Simon Green 2013-11-22 01:55:36 UTC
This change is now live. If there are any issues, do not reopen this bug.
Instead, you should create a new bug and reference this bug.

  -- simon