Bug 1110746

Summary: Daily usage do not check date range validity
Product: Red Hat OpenStack Reporter: Matthias Runge <mrunge>
Component: python-django-horizonAssignee: Matthias Runge <mrunge>
Status: CLOSED ERRATA QA Contact: Ido Ovadia <iovadia>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.0 (RHEL 7)CC: aortega, athomas, augol, mrunge, yeylon
Target Milestone: gaKeywords: Reopened, Triaged, ZStream
Target Release: 7.0 (Kilo)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-django-horizon-2015.1.0-7.el7ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1106385 Environment:
Last Closed: 2015-08-05 13:12:38 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: 1106385    
Bug Blocks:    

Description Matthias Runge 2014-06-18 11:22:20 UTC
+++ This bug was initially created as a clone of Bug #1106385 +++

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

--- Additional comment from Matthias Runge on 2014-06-18 05:01:36 EDT ---

I can not reproduce it. 
The error message is: Error: Invalid date format: Using today as default.

--- Additional comment from Amit Ugol on 2014-06-18 05:03:49 EDT ---

I can reproduce it on the version that I mentioned. What version are you testing it on?

--- Additional comment from Matthias Runge on 2014-06-18 07:21:32 EDT ---

Nah. scratch that. 

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

Comment 2 Matthias Runge 2015-02-16 08:35:39 UTC
This was merged for kilo

Comment 6 Ido Ovadia 2015-06-22 15:42:13 UTC
Verified
========
python-django-horizon-2015.1.0-10.el7ost.noarch

Comment 8 errata-xmlrpc 2015-08-05 13:12:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2015:1548