From c23227411b98ab561a9d80b568ce932f073b0d46 Mon Sep 17 00:00:00 2001 From: Nikolay Mahotkin Date: Tue, 16 Jul 2013 19:22:15 +0400 Subject: [PATCH] REST API returns traceback fix Fixes: bug #1200245 Change-Id: Ie23e1d6910892c55f729153cf5a3b238a4d3c605 --- AUTHORS | 1 + savanna/middleware/auth_valid.py | 3 +-- savanna/openstack/commons.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 96f78849..625927bc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -7,6 +7,7 @@ Jeremy Stanley Matthew Farrellee Nadya Privalova Nikita Konovalov +Nikolay Mahotkin Ruslan Kamaldinov Sergey Lukjanov Sergey Reshetnyak diff --git a/savanna/middleware/auth_valid.py b/savanna/middleware/auth_valid.py index fcf696d8..4adabae9 100644 --- a/savanna/middleware/auth_valid.py +++ b/savanna/middleware/auth_valid.py @@ -47,11 +47,10 @@ class AuthValidator: path = env['PATH_INFO'] if path != '/': version, url_tenant, rest = commons.split_path(path, 3, 3, True) - if not version or not url_tenant or not rest: LOG.info("Incorrect path: %s", path) resp = ex.HTTPNotFound("Incorrect path") - resp(env, start_response) + return resp(env, start_response) if token_tenant != url_tenant: LOG.debug("Unauthorized: token tenant != requested tenant") diff --git a/savanna/openstack/commons.py b/savanna/openstack/commons.py index 21828fa1..8acc3d00 100644 --- a/savanna/openstack/commons.py +++ b/savanna/openstack/commons.py @@ -52,7 +52,7 @@ def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False): count = len(segs) if (segs[0] or count < minsegs or count > maxsegs or '' in segs[1:minsegs]): - raise ValueError('Invalid path: %s' % path) + return None, None, None else: minsegs += 1 maxsegs += 1