From bc8341df779c02609eda401c7727707d41eb9329 Mon Sep 17 00:00:00 2001 From: Eric Juma Date: Thu, 1 Dec 2016 14:37:21 -0500 Subject: [PATCH] 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 --- etc/mixmatch.conf.sample | 19 +++++++++---------- mixmatch/auth.py | 14 +++++++------- mixmatch/config.py | 11 +++++------ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/etc/mixmatch.conf.sample b/etc/mixmatch.conf.sample index 9919fcc..1a8c745 100644 --- a/etc/mixmatch.conf.sample +++ b/etc/mixmatch.conf.sample @@ -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] diff --git a/mixmatch/auth.py b/mixmatch/auth.py index 1518a52..e803c6f 100644 --- a/mixmatch/auth.py +++ b/mixmatch/auth.py @@ -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) diff --git a/mixmatch/config.py b/mixmatch/config.py index 8bbd289..dd4c69f 100644 --- a/mixmatch/config.py +++ b/mixmatch/config.py @@ -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():