diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2011-10-18 12:41:37 -0700 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2011-10-18 12:41:37 -0700 |
| commit | 2bb474331d73e7c6d2a507cb097c50cfe65ad6b6 (patch) | |
| tree | 73ebad431ca4da6fcb8f705c54c78ad92d180b62 | |
| parent | 63c18186019754495a970773c0cc83dd330decbd (diff) | |
Fix issues in the ec2 middleware
Change-Id: I3ea371b70f6acc2d06175367cb20b217376ec0d2
| -rw-r--r-- | keystone/middleware/ec2_token.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/keystone/middleware/ec2_token.py b/keystone/middleware/ec2_token.py index d7d762d8..af141627 100644 --- a/keystone/middleware/ec2_token.py +++ b/keystone/middleware/ec2_token.py @@ -68,7 +68,7 @@ class EC2Token(wsgi.Middleware): # Disable "has no x member" pylint error # for httplib and urlparse # pylint: disable-msg=E1101 - o = urlparse(FLAGS.keystone_ec1_url) + o = urlparse(FLAGS.keystone_ec2_url) if o.scheme == "http": conn = httplib.HTTPConnection(o.netloc) else: @@ -80,10 +80,13 @@ class EC2Token(wsgi.Middleware): # NOTE(vish): We could save a call to keystone by # having keystone return token, tenant, # user, and roles from this call. + result = utils.loads(response) - # TODO(vish): check for errors + try: + token_id = result['access']['token']['id'] + except (AttributeError, KeyError): + raise webob.exc.HTTPBadRequest() - token_id = result['auth']['token']['id'] # Authenticated! req.headers['X-Auth-Token'] = token_id return self.application |
