diff options
-rw-r--r-- | nova/api/openstack/auth.py | 3 | ||||
-rw-r--r-- | nova/tests/api/openstack/fakes.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index 320443935..8461a8059 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -57,8 +57,9 @@ class AuthMiddleware(wsgi.Middleware): return faults.Fault(webob.exc.HTTPUnauthorized()) project = self.auth.get_project(FLAGS.default_project) + version = req.path.split('/')[1].replace('v', '') req.environ['nova.context'] = context.RequestContext(user, project, - version=req.script_name.replace('/v', '')) + version=version) return self.application def has_authentication(self, req): diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py index 2c4e57246..8ec1629f4 100644 --- a/nova/tests/api/openstack/fakes.py +++ b/nova/tests/api/openstack/fakes.py @@ -68,7 +68,7 @@ def fake_auth_init(self, application): @webob.dec.wsgify def fake_wsgi(self, req): - req.environ['nova.context'] = context.RequestContext(1, 1) + req.environ['nova.context'] = context.RequestContext(1, 1, version='1.0') if req.body: req.environ['inst_dict'] = json.loads(req.body) return self.application |