Project

Profile

Help

Issue #1140

closed

API call to URLs that do not exist cause 500s on RHEL 6

Added by amacdona@redhat.com over 8 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
2.7.0 Beta
Platform Release:
2.7.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

When making a call to a URL that does not exist, Pulp should respond with a 404. However, with RHEL 6 (and Django 1.4), the middleware is attempting to render a nonexistent 404 template and therefore returns a 500.

curl  -X GET -k -u admin:admin "https://localhost/pulp/api/v2/doesnotexist/"
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
 root@localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.2.15 (Red Hat) Server at localhost Port 443</address>
</body></html>

Traceback:

Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680) Internal Server Error: /pulp/api/v2/doesnotexist/
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680) Traceback (most recent call last):
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)   File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 148, in get_response
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)     response = callback(request, **param_dict)
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)   File "/usr/lib/python2.6/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)     response = view_func(request, *args, **kwargs)
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)   File "/usr/lib/python2.6/site-packages/django/views/defaults.py", line 20, in page_not_found
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)     t = loader.get_template(template_name) # You need to create a 404.html template.
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)   File "/usr/lib/python2.6/site-packages/django/template/loader.py", line 145, in get_template
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)     template, origin = find_template(template_name)
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)   File "/usr/lib/python2.6/site-packages/django/template/loader.py", line 138, in find_template
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680)     raise TemplateDoesNotExist(name)
Jul 15 10:26:44 mgmt4 pulp: django.request:ERROR: (14267-91680) TemplateDoesNotExist: 404.html

This does not affect 404s that are raised as a MissingResource.


Related issues

Related to Puppet Support - Issue #1485: TemplateDoesNotExist exception for '500.html' raised on v3 API endpointCLOSED - WONTFIXActions
Related to Puppet Support - Issue #1486: TemplateDoesNotExist exception for '404.html' raised on v3 API endpointCLOSED - WONTFIXActions

Also available in: Atom PDF