Commit 4b51ca72 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

stats: Fix unhandled exceptions

Catch two unhandled exceptions caused by requests that contained an
invalid (that could not be decrypted) VM hostname.
parent bbb1600a
......@@ -252,7 +252,10 @@ available_graph_types = {'cpu-bar': draw_cpu_bar,
@api_method(http_method='GET', token_required=False, user_required=False,
format_allowed=False, logger=log)
def grapher(request, graph_type, hostname):
hostname = decrypt(uenc(hostname))
try:
hostname = decrypt(uenc(hostname))
except (ValueError, TypeError):
raise faults.BadRequest("Invalid encrypted virtual server name")
fname = uenc(os.path.join(settings.RRD_PREFIX, hostname))
if not os.path.isdir(fname):
raise faults.ItemNotFound('No such instance')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment