Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 663277

Summary: 500 Internal error when accessing bookmark
Product: [Retired] Beaker Reporter: Tomas Lestach <tlestach>
Component: web UIAssignee: Dan Callaghan <dcallagh>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 0.6CC: bpeck, cito, dcallagh, mcsontos, mkudlej, rmancy
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Regression
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-24 10:23:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Lestach 2010-12-15 09:12:04 UTC
Description of problem:
I have a filtered beaker system stored. When accessing it without being logged in to beaker, the page isn't accessible.
When accessing first https://beaker.engineering.redhat.com/jobs/mine, then I can access also the stored bookmark.

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

How reproducible:
always

Steps to Reproduce:
1. try to access
https://beaker.engineering.redhat.com/jobs/mine?jobsearch-0.table=Status&jobsearch-0.operation=is+not&jobsearch-0.value=Completed&jobsearch-1.table=Status&jobsearch-1.operation=is+not&jobsearch-1.value=Cancelled&jobsearch-2.table=Status&jobsearch-2.operation=is+not&jobsearch-2.value=Aborted&Search=Search
without being logged in to beaker.
  
Actual results:
getting page:
===========================================
500 Internal error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Powered by CherryPy 2.3.0
===========================================

Expected results:
filtered my jobs result

Additional info:
Now try to access https://beaker.engineering.redhat.com/jobs/mine and then try to access the provided link again -> success

Comment 1 Tomas Lestach 2010-12-15 14:57:29 UTC
Please, note this is a regression.

Comment 2 Dan Callaghan 2010-12-16 06:20:01 UTC
This is caused by a bug in TurboGears, which we are hitting now that we have identity.force_external_redirect=True (as of Beaker 0.6.0).

The constructor for turbogears.identity.IdentityFailure does not take into account the possibility that cherrypy.request.params might contain dicts or lists due to the NestedVariablesFilter. In a case like:

/jobs/mine?jobsearch-0.table=Status&jobsearch-0.operation=is+not&jobsearch-0.value=Completed&jobsearch-1.table=Status&jobsearch-1.operation=is+not&jobsearch-1.value=Cancelled&jobsearch-2.table=Status&jobsearch-2.operation=is+not&jobsearch-2.value=Aborted&Search=Search

the NestedVariablesFilter gives us params like:

{'jobsearch': [{'table': u'Status', 'operation': u'is not', 'value': u'Completed'}, {'table': u'Status', 'operation': u'is not', 'value': u'Cancelled'}, {'table': u'Status', 'operation': u'is not', 'value': u'Aborted'}]}

which then ends up mangled when we redirect to /login:

/login?jobsearch={%27table%27%3A+u%27Status%27%2C+%27operation%27%3A+u%27is+not%27%2C+%27value%27%3A+u%27Completed%27}&jobsearch={%27table%27%3A+u%27Status%27%2C+%27operation%27%3A+u%27is+not%27%2C+%27value%27%3A+u%27Cancelled%27}&jobsearch={%27table%27%3A+u%27Status%27%2C+%27operation%27%3A+u%27is+not%27%2C+%27value%27%3A+u%27Aborted%27}&Search=Search&forward_url=%2Fjobs%2Fmine

Comment 3 Dan Callaghan 2010-12-21 04:14:18 UTC
I've got a Beaker test case for this, but it will need to be fixed by patching TurboGears. I've tested this patch:

--- TurboGears-1.0.8.orig/turbogears/identity/exceptions.py
+++ TurboGears-1.0.8/turbogears/identity/exceptions.py
@@ -83,9 +83,11 @@
             # by Apache/nginx or something else that CherryPy won't find.
             # We also need to set the forward_url, because the Referer header
             # won't work with an external redirect.
-            params = cherrypy.request.params
-            params['forward_url'] = cherrypy.request.path_info
-            raise cherrypy.HTTPRedirect(turbogears.url(url, params))
+            forward_url = cherrypy.request.path_info
+            if cherrypy.request.query_string:
+                forward_url += '?' + cherrypy.request.query_string
+            raise cherrypy.HTTPRedirect(
+                    turbogears.url(url, dict(forward_url=forward_url)))
         else:
             # use internal redirect which is quicker
             cherrypy.InternalRedirect.__init__(self, url)

I've rebuilt TurboGears locally with this patch and it works fine. I also updated to 1.0.9 (we have 1.0.8 built at present).

Bill, should I build TurboGears-1.0.9 with this patch, and we can upgrade to that in our 0.6.2 release?

Comment 4 Dan Callaghan 2011-01-23 21:59:18 UTC
*** Bug 671325 has been marked as a duplicate of this bug. ***

Comment 5 Dan Callaghan 2011-02-07 21:52:42 UTC
This fix will be going in with 0.6.5 as a patch to TurboGears 1.0.8. We can upgrade TurboGears at a later point.

Comment 9 Tomas Lestach 2011-02-24 11:14:45 UTC
Thanks!

Comment 10 Cito 2011-07-08 17:00:23 UTC
This has now also been fixed in TurboGears for all 1.x branches in r7358, i.e. bugfix releases 1.0.10, 1.1.3 and in 1.5.