← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1504184] [NEW] Glance does not error gracefully on token validation error

 

Public bug reported:

When the registry has an error validating the token that the api has
sent it a 500 is returned, rather than 401. This is with the latest
master.

{code}
2015-10-08 15:03:16.939 ERROR glance.registry.client.v1.client [req-b561060e-d60c-4085-820d-1e87e64448ed 9f81b40c4b484be99a06754f32500271 51852dcd7e304719939f29fc2c3f3558] Registry client request GET /images/detail raised NotAuthenticated
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client Traceback (most recent call last):
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 121, in do_request
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     **kwargs)
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 74, in wrapped
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     return func(self, *args, **kwargs)
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 375, in do_request
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     headers=copy.deepcopy(headers))
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 88, in wrapped
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     return func(self, method, url, body, headers)
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 517, in _do_request
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     raise exception.NotAuthenticated(res.read())
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client NotAuthenticated: Authentication required
2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client 
2015-10-08 15:03:16.940 ERROR glance.common.wsgi [req-b561060e-d60c-4085-820d-1e87e64448ed 9f81b40c4b484be99a06754f32500271 51852dcd7e304719939f29fc2c3f3558] Caught error: Authentication required
2015-10-08 15:03:16.940 TRACE glance.common.wsgi Traceback (most recent call last):
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/wsgi.py", line 879, in __call__
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     request, **action_args)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/wsgi.py", line 907, in dispatch
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return method(*args, **kwargs)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/api/v1/images.py", line 366, in detail
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     images = registry.get_images_detail(req.context, **params)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/api.py", line 161, in get_images_detail
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return c.get_images_detailed(**kwargs)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 150, in get_images_detailed
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     res = self.do_request("GET", "/images/detail", params=params)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 136, in do_request
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     'exc_name': exc_name})
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 195, in __exit__
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     six.reraise(self.type_, self.value, self.tb)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 121, in do_request
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     **kwargs)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 74, in wrapped
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return func(self, *args, **kwargs)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 375, in do_request
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     headers=copy.deepcopy(headers))
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 88, in wrapped
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return func(self, method, url, body, headers)
2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 517, in _do_request
2015-10-08 15:03:16.940 TRACE glance.common.wsgi     raise exception.NotAuthenticated(res.read())
2015-10-08 15:03:16.940 TRACE glance.common.wsgi NotAuthenticated: Authentication required
2015-10-08 15:03:16.940 TRACE glance.common.wsgi 
2015-10-08 15:03:16.993 INFO eventlet.wsgi.server [req-b561060e-d60c-4085-820d-1e87e64448ed 9f81b40c4b484be99a06754f32500271 51852dcd7e304719939f29fc2c3f3558] 192.168.0.100 - - [08/Oct/2015 15:03:16] "GET /v1/images/detail?sort_key=name&sort_dir=asc&limit=20 HTTP/1.1" 500 454 0.891754
{code}

** Affects: glance
     Importance: Undecided
     Assignee: Martin Tsvetanov (martin-iva-tsvetanov)
         Status: New

** Changed in: glance
     Assignee: (unassigned) => Martin Tsvetanov (martin-iva-tsvetanov)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1504184

Title:
  Glance does not error gracefully on token validation error

Status in Glance:
  New

Bug description:
  When the registry has an error validating the token that the api has
  sent it a 500 is returned, rather than 401. This is with the latest
  master.

  {code}
  2015-10-08 15:03:16.939 ERROR glance.registry.client.v1.client [req-b561060e-d60c-4085-820d-1e87e64448ed 9f81b40c4b484be99a06754f32500271 51852dcd7e304719939f29fc2c3f3558] Registry client request GET /images/detail raised NotAuthenticated
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client Traceback (most recent call last):
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 121, in do_request
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     **kwargs)
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 74, in wrapped
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     return func(self, *args, **kwargs)
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 375, in do_request
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     headers=copy.deepcopy(headers))
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 88, in wrapped
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     return func(self, method, url, body, headers)
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client   File "/opt/stack/glance/glance/common/client.py", line 517, in _do_request
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client     raise exception.NotAuthenticated(res.read())
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client NotAuthenticated: Authentication required
  2015-10-08 15:03:16.939 TRACE glance.registry.client.v1.client 
  2015-10-08 15:03:16.940 ERROR glance.common.wsgi [req-b561060e-d60c-4085-820d-1e87e64448ed 9f81b40c4b484be99a06754f32500271 51852dcd7e304719939f29fc2c3f3558] Caught error: Authentication required
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi Traceback (most recent call last):
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/wsgi.py", line 879, in __call__
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     request, **action_args)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/wsgi.py", line 907, in dispatch
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return method(*args, **kwargs)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/api/v1/images.py", line 366, in detail
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     images = registry.get_images_detail(req.context, **params)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/api.py", line 161, in get_images_detail
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return c.get_images_detailed(**kwargs)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 150, in get_images_detailed
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     res = self.do_request("GET", "/images/detail", params=params)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 136, in do_request
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     'exc_name': exc_name})
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 195, in __exit__
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     six.reraise(self.type_, self.value, self.tb)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/registry/client/v1/client.py", line 121, in do_request
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     **kwargs)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 74, in wrapped
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return func(self, *args, **kwargs)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 375, in do_request
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     headers=copy.deepcopy(headers))
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 88, in wrapped
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     return func(self, method, url, body, headers)
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi   File "/opt/stack/glance/glance/common/client.py", line 517, in _do_request
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi     raise exception.NotAuthenticated(res.read())
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi NotAuthenticated: Authentication required
  2015-10-08 15:03:16.940 TRACE glance.common.wsgi 
  2015-10-08 15:03:16.993 INFO eventlet.wsgi.server [req-b561060e-d60c-4085-820d-1e87e64448ed 9f81b40c4b484be99a06754f32500271 51852dcd7e304719939f29fc2c3f3558] 192.168.0.100 - - [08/Oct/2015 15:03:16] "GET /v1/images/detail?sort_key=name&sort_dir=asc&limit=20 HTTP/1.1" 500 454 0.891754
  {code}

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1504184/+subscriptions


Follow ups