Fix token flush fails with recursion depth exception
keystone-manage token_flush was failing with a recursion depth exception error. This is because when a property was referenced in token.persistence.Manager it would go into an infinite recursion trying to resolve it. token.persistence.PersistenceManager should have been used instead. Note that I added a test for keystone.cli TokenFlush, but for some reason it doesn't actually expose the problem. I'll leave it there since it increases coverage. Change-Id: If5af4fe0811a59157c2f68d06c264815409689e1 Closes-Bug: #1363224
This commit is contained in:
parent
e0d83776bd
commit
4a587f2bfc
@ -172,7 +172,7 @@ class TokenFlush(BaseApp):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def main(cls):
|
def main(cls):
|
||||||
token_manager = token.persistence.Manager()
|
token_manager = token.persistence.PersistenceManager()
|
||||||
token_manager.driver.flush_expired_tokens()
|
token_manager.driver.flush_expired_tokens()
|
||||||
|
|
||||||
|
|
||||||
|
29
keystone/tests/test_cli.py
Normal file
29
keystone/tests/test_cli.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright 2014 IBM Corp.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from keystone import cli
|
||||||
|
from keystone import tests
|
||||||
|
from keystone.tests.ksfixtures import database
|
||||||
|
|
||||||
|
|
||||||
|
class CliTestCase(tests.SQLDriverOverrides, tests.TestCase):
|
||||||
|
def config_files(self):
|
||||||
|
config_files = super(CliTestCase, self).config_files()
|
||||||
|
config_files.append(tests.dirs.tests_conf('backend_sql.conf'))
|
||||||
|
return config_files
|
||||||
|
|
||||||
|
def test_token_flush(self):
|
||||||
|
self.useFixture(database.Database())
|
||||||
|
self.load_backends()
|
||||||
|
cli.TokenFlush.main()
|
Loading…
Reference in New Issue
Block a user