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 ...
Alias: None
Product: Beaker
Classification: Community
Component: general
Version: develop
Hardware: Unspecified
OS: Unspecified
low vote
Target Milestone: 24.5
Assignee: Dan Callaghan
QA Contact: Dan Callaghan
Keywords: Patch
Depends On:
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)

Clone Of:
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:

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):


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:


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
   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
 KeyError: 'value'

Comment 4 Dan Callaghan 2017-10-10 06:51:23 UTC

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.