error when deleting a consumer token (sql)

Bug #1215493 reported by Steve Martinelli on 2013-08-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Steve Martinelli

Bug Description

Saw this when creating client support:
$ openstack consumer delete 8b0899403f93496384cddc0755953ba8
ERROR: An unexpected error prevented the server from fulfilling your request. 'token' (HTTP 500)

Keystone error:
(keystone.common.wsgi): 2013-08-22 10:16:41,241 ERROR wsgi __call__ 'token'
Traceback (most recent call last):
  File "/opt/stack/keystone/keystone/common/", line 237, in __call__
    result = method(context, **params)
  File "/opt/stack/keystone/keystone/contrib/oauth1/", line 60, in delete_consumer
    self.token_api.delete_tokens(user_id, consumer_id=consumer_id)
  File "/opt/stack/keystone/keystone/common/", line 44, in _wrapper
    return f(*args, **kw)
  File "/opt/stack/keystone/keystone/token/backends/", line 109, in delete_tokens
    if not self._consumer_matches(consumer_id, token_ref_dict):
  File "/opt/stack/keystone/keystone/token/backends/", line 125, in _consumer_matches
    oauth = token_ref_dict['token_data']['token'].get('OS-OAUTH1', {})
KeyError: 'token'

Suggested fix is to wrap the else block of _consumer_matches in a try, and catch any KeyErrors.

Changed in keystone:
assignee: nobody → Steve Martinelli (stevemar)
Changed in keystone:
status: New → In Progress
Dolph Mathews (dolph) on 2013-08-24
Changed in keystone:
milestone: none → havana-3
importance: Undecided → Medium

Submitter: Jenkins
Branch: master

commit f28d9f4f7b222119b5c5481eb7d318695ce43c95
Author: Steve Martinelli <email address hidden>
Date: Wed Aug 21 14:23:04 2013 -0500

    Fix error where consumer is not deleted from sql

    Looks like when the token sql backend was going through tokens
    to delete, it didn't like if the token ref didn't have a token
    field. I placed a guard in there now.

    fixes bug: #1215493

    Change-Id: Ia12f5e4d9af71c322c9230464ae39ec88303b600

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-09-05
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in keystone:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers