Bug 1106385

Summary: Daily usage do not check date range validity
Product: [Community] RDO Reporter: Amit Ugol <augol>
Component: python-django-horizonAssignee: Matthias Runge <mrunge>
Status: CLOSED UPSTREAM QA Contact: Amit Ugol <augol>
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: aortega, jpichon, mrunge, yeylon
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1110746 (view as bug list) Environment:
Last Closed: 2014-10-08 09:19:52 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:
Bug Depends On:    
Bug Blocks: 1110746    

Description Amit Ugol 2014-06-09 08:35:33 UTC
Description of problem:
A custome report is generated for the dates between From and To.
If the range is illogical, a blank search resolt is being returned, but a search still occures. The ranges here should be protected, so for example a user should be able to insert
From: Steak and Kidney Pie
To: -1000-01-01
which returns a 500 response.

Version-Release number of selected component (if applicable):
python-django-horizon-2014.1-7.el7ost.noarch

How reproducible:
Always

Steps to Reproduce:
1. go to Resources Usage > Daily Usage
2. select as range Other
3. Enter From: something silly
4. Enter To: something sillier

Actual results:
Something Went Wrong message.

Expected results:
a warning saying that ranges are not valid
ranges should be protected. a good range here might be from EPOC to 2025 and date format only.

Additional info:
2014-06-09 08:30:06,544 31597 ERROR django.request Internal Server Error: /dashboard/admin/metering/report
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 38, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 86, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 54, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 38, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 86, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 162, in post
    return self.get(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 154, in get
    handled = self.construct_tables()
  File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 137, in construct_tables
    tables = self.get_tables().values()
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/metering/views.py", line 106, in get_tables
    project_data = self.load_data(self.request)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/metering/views.py", line 153, in load_data
    3600 * 24)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/metering/views.py", line 246, in query_data
    date_options)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/metering/views.py", line 225, in _calc_date_args
    raise ValueError("The dates haven't been "
ValueError: The dates haven't been recognized

Comment 1 Matthias Runge 2014-06-18 09:01:36 UTC
I can not reproduce it. 
The error message is: Error: Invalid date format: Using today as default.

Comment 2 Amit Ugol 2014-06-18 09:03:49 UTC
I can reproduce it on the version that I mentioned. What version are you testing it on?

Comment 3 Matthias Runge 2014-06-18 11:21:32 UTC
Nah. scratch that. 

Reported upstream, raised prio.
Amit, thank you for insisting here, you're absolutely right.

Comment 4 Matthias Runge 2014-07-16 07:47:24 UTC
upstream review: https://review.openstack.org/107011

Comment 5 Matthias Runge 2014-10-08 09:19:52 UTC
This is not a specific rdo bug.

It's discussed upstream: https://bugs.launchpad.net/horizon/+bug/1331427