Skip to content
Snippets Groups Projects
Commit e2ae9123 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Replace httperror module with ganeti.http

The generic HTTP server doesn't know about httperror based exceptions
and would treat them as unknown exceptions, thereby not doing the right
thing with HTTP errors.

Reviewed-by: iustinp
parent d2b92ffc
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,6 @@ from ganeti import http
from ganeti import errors
from ganeti import rpc
from ganeti.rapi import connector
from ganeti.rapi import httperror
class RESTRequestHandler(http.HTTPRequestHandler):
......@@ -35,7 +34,7 @@ class RESTRequestHandler(http.HTTPRequestHandler):
def setup(self):
super(RESTRequestHandler, self).setup()
self._resmap = connector.Mapper()
def HandleRequest(self):
""" Handels a request.
......@@ -47,7 +46,7 @@ class RESTRequestHandler(http.HTTPRequestHandler):
try:
fn = getattr(handler, command)
except AttributeError, err:
raise httperror.HTTPBadRequest()
raise http.HTTPBadRequest()
try:
result = fn()
......@@ -55,8 +54,8 @@ class RESTRequestHandler(http.HTTPRequestHandler):
except errors.OpPrereqError, err:
# TODO: "Not found" is not always the correct error. Ganeti's core must
# differentiate between different error types.
raise httperror.HTTPNotFound(message=str(err))
raise http.HTTPNotFound(message=str(err))
return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment