Bug 1498804 - system search fails with 500 Internal Server Error when "value" parameter is missing: KeyError: 'value'
Summary: system search fails with 500 Internal Server Error when "value" parameter is ...
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Community
Component: general
Version: develop
Hardware: Unspecified
OS: Unspecified
unspecified
low vote
Target Milestone: 24.5
Assignee: Dan Callaghan
QA Contact: Dan Callaghan
URL:
Whiteboard:
Keywords: Patch
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-05 10:00 UTC by Jan Hutař
Modified: 2017-10-27 06:47 UTC (History)
4 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2017-10-27 06:47:32 UTC


Attachments (Terms of Use)

Description Jan Hutař 2017-10-05 10:00:07 UTC
Description of problem:
system search fails with ISE


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


How reproducible:
always


Steps to Reproduce:
1. Systems -> All -> Show Search Options
2. Set "System/LabController" "is" "..."
3. Add "Key/Value" "HVM" "is" "1"
4. Add "System/Hypervisor" "is" and keep last field empty
5. Hit "Search" button


Actual results:
500 Internal error


Expected results:
Should work


Additional info:
Surprisingly, in different order query works

Comment 1 Dan Callaghan 2017-10-06 00:49:20 UTC
I can't reproduce this... Following those steps I end up at this URL, which works (should be returning machines which are not virtualised):

https://beaker.engineering.redhat.com/?systemsearch-0.table=System%2FLabController&systemsearch-0.keyvalue=&systemsearch-0.operation=is&systemsearch-0.value=lab-02.rhts.eng.bos.redhat.com&systemsearch-1.table=Key%2FValue&systemsearch-1.keyvalue=HVM&systemsearch-1.operation=is&systemsearch-1.value=1&systemsearch-2.table=System%2FHypervisor&systemsearch-2.keyvalue=&systemsearch-2.operation=is&systemsearch-2.value=

It could be some kind of bug/race condition in the search bar which ended up producing invalid search terms which the server couldn't parse. Do you have the URL where you saw this 500?

Also, we have had a few bug reports in the past where the search URL was manipulated by some Greasemonkey script producing invalid search parameters. For example bug 1432408, bug 1277632. So please check that is not the case here.

Comment 2 Jan Hutař 2017-10-09 05:31:21 UTC
Oh, I'm sorry, looks like there are missing steps:

3.1 Click Search
3.2 Click "+ Add" to be able to add third criteria

So opening this link:

https://beaker.engineering.redhat.com/?systemsearch-0.table=System%2FLabController&systemsearch-0.keyvalue=&systemsearch-0.operation=contains&systemsearch-0.value=lab-02.rhts.eng.brq.redhat.com&systemsearch-1.table=Key%2FValue&systemsearch-1.keyvalue=HVM&systemsearch-1.operation=is&systemsearch-1.value=1&systemsearch_column_System%2FArch=System%2FArch&systemsearch_column_System%2FModel=System%2FModel&systemsearch_column_System%2FName=System%2FName&systemsearch_column_System%2FStatus=System%2FStatus&systemsearch_column_System%2FType=System%2FType&systemsearch_column_System%2FUser=System%2FUser&systemsearch_column_System%2FVendor=System%2FVendor

and clicking "+ Add" and adding "System/Hypervisor" "is" and keep last field empty as third filter and clicking "Search" reproduces it reliably for me (firefox-56.0-3.fc26.x86_64).

Note that reason for having that empty field is to get machines which are not virtualized (i.e. do not have hypervisor set).

Comment 3 Dan Callaghan 2017-10-09 07:46:35 UTC
Okay I gotcha.

It looks like the Python side is always expecting the "value" parameter to be present, even if it's just empty string. And indeed it usually is, except under certain circumstances where the JS has added a new row to the search box. In that case the control is not "successful" for whatever reason and the value parameter is ommitted entirely, causing the 500.

cherrypy.msg INFO HTTP: Page handler: <bound method Root.index of <bkr.server.controllers.Root object at 0x7f3828ee8d90>>
 Traceback (most recent call last):
   File "/usr/lib/python2.6/site-packages/CherryPy-2.3.0-py2.6.egg/cherrypy/_cphttptools.py", line 121, in _run
     self.main()
   File "/usr/lib/python2.6/site-packages/CherryPy-2.3.0-py2.6.egg/cherrypy/_cphttptools.py", line 264, in main
     body = page_handler(*virtual_path, **self.params)
   File "<string>", line 3, in index
   File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 384, in <lambda>
     expose = lambda func, *args, **kw: func(*args, **kw)
   File "<string>", line 3, in index
   File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 361, in expose
     *args, **kw)
   File "/usr/lib/python2.6/site-packages/bkr/server/wsgi.py", line 90, in run_with_transaction_noop
     return func(*args, **kwargs)
   File "<generated code>", line 0, in _expose
   File "/usr/lib/python2.6/site-packages/peak/rules/core.py", line 153, in __call__
     return self.body(*args, **kw)
   File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 390, in <lambda>
     fragment, options, args, kw)))
   File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 425, in _execute_func
     output = errorhandling.try_call(func, *args, **kw)
   File "/usr/lib/python2.6/site-packages/turbogears/errorhandling.py", line 77, in try_call
     return func(self, *args, **kw)
   File "<string>", line 3, in index
   File "/usr/lib/python2.6/site-packages/turbogears/paginate.py", line 147, in decorated
     output = func(*args, **kw)
   File "/usr/lib/python2.6/site-packages/bkr/server/controllers.py", line 288, in index
     title=u'Systems', *args, **kw)
   File "/usr/lib/python2.6/site-packages/bkr/server/controllers.py", line 517, in _systems
     systems = self._system_search(kw,sys_search)
   File "/usr/lib/python2.6/site-packages/bkr/server/controllers.py", line 396, in _system_search
     sys_search.append_results(cls_ref,search['value'],col,search['operation'])
 KeyError: 'value'

Comment 4 Dan Callaghan 2017-10-10 06:51:23 UTC
https://gerrit.beaker-project.org/5870

Comment 7 Dan Callaghan 2017-10-27 06:47:32 UTC
Beaker 24.5 has been released.


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