Unable to cache auth tokens

Move token caching configuration options from [DEFAULT] to
[keystone], and change [keystone] to [auth]. Update references
to these parts of configuration file to reflect the change.
Also remove token_caching from config file as it is not needed.

Change-Id: I22ee4bbf1febe5076988eaa7afeb15fcb8c28b09
Closes-bug: 1646569
This commit is contained in:
Eric Juma 2016-12-01 14:37:21 -05:00
parent 042146da27
commit bc8341df77
3 changed files with 21 additions and 23 deletions

View File

@ -1,22 +1,21 @@
[DEFAULT]
aggregation=True
token_caching=False
search_by_broadcast=True
service_providers=default, coffee-sp
caching=True
service_providers=default, cornmeal-sp
image_api_versions = v2.3, v2.2, v2.1, v2.0, v1.1, v1.0
volume_api_versions = v3.0, v2.0, v1.0
[database]
connection="sqlite:////home/ubuntu/proxy.db"
[keystone]
[auth]
auth_url="http://127.0.0.1:5000/v3"
username="admin"
user_domain_id="default"
password="nomoresecrete"
project_name="admin"
project_domain_id="default"
caching=True
[cache]
enabled=True
@ -29,12 +28,12 @@ auth_url="http://127.0.0.1:5000/v3"
image_endpoint="http://localhost:9292"
volume_endpoint="http://localhost:8776"
[sp_coffee-sp]
sp_name=coffee-sp
messagebus="rabbit://stackrabbit:stackqueue@192.168.0.106"
auth_url="http://192.168.0.106:5000/v3"
image_endpoint="http://192.168.0.106:9292"
volume_endpoint="http://192.168.0.106:8776"
[sp_cornmeal-sp]
sp_name=cornmeal-sp
messagebus="rabbit://stackrabbit:stackqueue@192.168.0.141"
auth_url="http://192.168.0.141:5000/v3"
image_endpoint="http://192.168.0.141:9292"
volume_endpoint="http://192.168.0.141:8776"
# Logging
[loggers]

View File

@ -30,12 +30,12 @@ def get_client():
"""Return a Keystone client capable of validating tokens."""
LOG.info("Getting Admin Client")
service_auth = identity.Password(
auth_url=CONF.keystone.auth_url,
username=CONF.keystone.username,
password=CONF.keystone.password,
project_name=CONF.keystone.project_name,
project_domain_id=CONF.keystone.project_domain_id,
user_domain_id=CONF.keystone.user_domain_id
auth_url=CONF.auth.auth_url,
username=CONF.auth.username,
password=CONF.auth.password,
project_name=CONF.auth.project_name,
project_domain_id=CONF.auth.project_domain_id,
user_domain_id=CONF.auth.user_domain_id
)
local_session = session.Session(auth=service_auth)
return v3.client.Client(session=local_session)
@ -55,7 +55,7 @@ def get_local_auth(user_token):
project_id = token_data['project']['id']
local_auth = identity.v3.Token(auth_url=CONF.keystone.auth_url,
local_auth = identity.v3.Token(auth_url=CONF.auth.auth_url,
token=user_token,
project_id=project_id)

View File

@ -60,10 +60,9 @@ proxy_opts = [
]
# Keystone
keystone_group = cfg.OptGroup(name='keystone',
title='Keystone Config Group')
auth_group = cfg.OptGroup(name='auth', title='Keystone Config Group')
keystone_opts = [
auth_opts = [
cfg.StrOpt('auth_url',
default='http://localhost:35357/v3',
help='Keystone AUTH URL'),
@ -92,8 +91,8 @@ keystone_opts = [
CONF.register_opts(proxy_opts)
CONF.register_group(keystone_group)
CONF.register_opts(keystone_opts, keystone_group)
CONF.register_group(auth_group)
CONF.register_opts(auth_opts, auth_group)
# Logging
log.register_options(CONF)
@ -105,7 +104,7 @@ MEMOIZE_SESSION = None
session_cache_region = cache.create_region()
MEMOIZE_SESSION = cache.get_memoization_decorator(
CONF, session_cache_region, group=None)
CONF, session_cache_region, group='auth')
def load_config():