Bug 1182545

Summary: Internal error when searching systems added to Beaker after/before/at date
Product: [Retired] Beaker Reporter: Jan Stodola <jstodola>
Component: web UIAssignee: matt jia <mjia>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 19CC: aigao, asaha, dcallagh, dowang, mjia
Target Milestone: 19.3Keywords: Patch, Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-17 06:34:22 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:

Description Jan Stodola 2015-01-15 12:23:18 UTC
Description of problem:
Beaker shows "500 Internal error" when trying to find systems using the "System/Added" option.

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

How reproducible:
always

Steps to Reproduce:
1. click "Show Search Options"
2. Table: System/Added
3. Operation: after/before/is
4. Value: select any date (for example 01/04/2015)
5. Search

Actual results:
500 Internal error
The server encountered an unexpected condition which prevented it from fulfilling the request.

Expected results:
A list of machines

Comment 1 Amit Saha 2015-01-15 12:36:31 UTC
Traceback:

Jan 15 12:34:27 beaker-devel beaker-server[27696]:    File "/usr/lib/python2.6/site-packages/bkr/server/controllers.py", line 399, in _system_search
Jan 15 12:34:27 beaker-devel beaker-server[27696]:      sys_search.append_results(cls_ref,search['value'],col,search['operation'])
Jan 15 12:34:27 beaker-devel beaker-server[27696]:    File "/usr/lib/python2.6/site-packages/bkr/server/search_utility.py", line 790, in append_results
Jan 15 12:34:27 beaker-devel beaker-server[27696]:      self.queri = self.queri.filter(filter_final())
Jan 15 12:34:27 beaker-devel beaker-server[27696]:    File "/usr/lib/python2.6/site-packages/bkr/server/search_utility.py", line 777, in <lambda>
Jan 15 12:34:27 beaker-devel beaker-server[27696]:      filter_final = lambda: filter_func(mycolumn.column,value)
Jan 15 12:34:27 beaker-devel beaker-server[27696]:    File "/usr/lib/python2.6/site-packages/bkr/server/search_utility.py", line 1094, in added_after_filter
Jan 15 12:34:27 beaker-devel beaker-server[27696]:      date = datetime.datetime.strptime(val, '%Y-%m-%d')
Jan 15 12:34:27 beaker-devel beaker-server[27696]:    File "/usr/lib64/python2.6/_strptime.py", line 325, in _strptime
Jan 15 12:34:27 beaker-devel beaker-server[27696]:      (data_string, format))
Jan 15 12:34:27 beaker-devel beaker-server[27696]:  ValueError: time data '01/07/2015' does not match format '%Y-%m-%d'

When the date is selected from the calendar on the search page, it comes as mm-dd-yy

Comment 2 matt jia 2015-01-28 02:16:36 UTC
On gerrit:

  http://gerrit.beaker-project.org/#/c/3954/

Matt Jia

Comment 3 matt jia 2015-02-06 03:20:51 UTC
Steps to Verify:
1. Go to systems page and click on "Show Search Options"
2. Select Table: System/Added
3. Select Operation: after/before/is
4. Type Value: select any date from data picker
5. Click Search and the results should be shown in the table grid.

Cheers, Matt Jia

Comment 6 matt jia 2015-02-11 00:59:45 UTC
(In reply to wangdong from comment #5)

> BTW.
> 
> If I given a invalid data value it will return "500 internal server error"
> 
> is this need fix?
> 
> I think we should add restrict about data Value, it should only input valid
> data for "Value"
> 
> Please investigate it.

Yeah, this is an existing bug in the system search bar. I have uploaded a patch to fix this.

http://gerrit.beaker-project.org/#/c/3974/

Cheers, Matt Jia

Comment 7 Dan Callaghan 2015-02-23 02:12:26 UTC
Setting back to ASSIGNED as per comment 5/6, once that patch is merged this can go back to ON_QA.

Comment 8 matt jia 2015-02-27 01:52:29 UTC
(In reply to wangdong from comment #5)
> If I given a invalid data value it will return "500 internal server error"
> 
> is this need fix?
> 
> I think we should add restrict about data Value, it should only input valid
> data for "Value"
> 
> Please investigate it.

Verify Steps:

1.Go to systems page and click on "Show Search Options"
2. Select Table: System/Added
3. Select Operation: after/before/is
4. Type an invalid date
5. the input box should become red to indicate the value is invalid
6. Click Search button and you will notice that the input value is restored to 
default current date which is today.
7. Type an invalid date again, make sure the date picker is closed by using ESC
when doing this.
8. click Search button and you should see the error message and the form is not submmited.

Cheers, Matt Jia

Comment 11 Dan Callaghan 2015-03-17 06:34:22 UTC
Beaker 19.3 has been released.